Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- //find first element with "someAttr" attribute
- document.querySelector('[someAttr]');
- //find all elements with "someAttr" attribute
- document.querySelectorAll('[someAttr]');
- //so this is how you can get a specific element without using id or class
- document.querySelector([attribute="value"])
- .innerHTML = "element text changed!";
- </script>
Add Comment
Please, Sign In to add comment