Traversing the DOM

From rbachwiki
Revision as of 14:30, 25 October 2016 by Bacchas (talk | contribs) (Created page with "==Selecting Elements with the query selector== document.querySelector('h1'); document.querySelector('.classname'); // will return the 1st item with that class name document...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Selecting Elements with the query selector

document.querySelector('h1');
document.querySelector('.classname'); // will return the 1st item with that class name
document.querySelectorAll('.classname'); // will return a array with all items with that class name
document.querySelector('#idname');