![]() ![]() You can work around this if necessary by looping through all the elements on the page to see whether they have the attribute set: var withProperty = ,Įls = document.getElementsByTagName('span'), // or '*' for all types of element ![]() It would be better to specify a tag name if possible: document.querySelectorAll('span') This finds all elements with the attribute property. (Complete list of attribute selectors on MDN.) document.querySelectorAll('') // All with attribute named "property"ĭocument.querySelectorAll('') // All with "property" set to "value" exactly. Yes, the function is querySelectorAll (or querySelector for a single element), which allows you to use CSS selectors to find elements. ![]()
0 Comments
Leave a Reply. |