Skip to content

Instantly share code, notes, and snippets.

@jbail
Created December 23, 2012 22:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbail/4366493 to your computer and use it in GitHub Desktop.
Save jbail/4366493 to your computer and use it in GitHub Desktop.
querySelector and querySelectorAll
var article = document.getElementById('article');
var p = article.querySelector('p'); //returns the first 'p' tag that's a child of the #article element
p = article.querySelectorAll('p'); //returns a NodeList containing all 'p' tags that are children of the #article element
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment