how to select elements by attribute js code example Example: javascript select element with attribute document.querySelectorAll('[attrname="value"]');