Difference between revisions of "Traversing the DOM"

From rbachwiki
Jump to navigation Jump to search
(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...")
 
Line 4: Line 4:
  document.querySelectorAll('.classname'); // will return a array with all items with that class name
  document.querySelectorAll('.classname'); // will return a array with all items with that class name
  document.querySelector('#idname');
  document.querySelector('#idname');
== Creating and Inserting Elements==
<pre>
</pre>

Revision as of 17:55, 25 October 2016

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');

Creating and Inserting Elements