Bijan
Bijan

Reputation: 8586

Javascript querySelectorAll Return Only Selectors I Specify

I need assistance with querySelectorAll. Is there a way to have the function return the elements that only I specify?

i.e. document.querySelectorAll('span.Fz-xxs') could return an element <span class="blah1 blah2 Fz-xxs"> but I just want it to return elements that are <span class="Fz-xxs">

Upvotes: 1

Views: 74

Answers (1)

techfoobar
techfoobar

Reputation: 66663

To select a <span> with just the class you want (ex: Fx-xxs) and nothing else, you can use:

document.querySelectorAll('span[class="Fz-xxs"]')

Upvotes: 3

Related Questions