Skip to content

Commit

Permalink
Updated comments
Browse files Browse the repository at this point in the history
  • Loading branch information
vasanthk committed Mar 14, 2016
1 parent 9e6b065 commit e150aed
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions js/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
*/

// BASIC ELEMENT SELECTORS
document.getElementById("IDName"); // Selects the first element with the ID passed. How ID's should be used once in a HTML, it selects the first element, if the ID is duplicated, it selects the first one.
document.getElementsByClassName("ClassName"); // Selects the elements with the Class name passed. It returns an array with the elements.
document.getElementsByName("Name"); // Selects the elements with the Name passed, returns an array with the elements.
document.getElementsByTagName("TagName"); // Selects the elements with the passed Tag, returns an array with the elements
document.querySelector("#IDName or .ClassName"); // Selects the first one element that it finds with the passed name and type.
document.querySelectorAll("#IDName or .ClassName"); // Selects all the element that it finds with the passed name and type. It returns an array
document.getElementById("IDName"); // Selects the first element with the ID passed. It is invalid to use multiple IDs in HTML, however if duplicated, it selects the first one.
document.getElementsByClassName("ClassName"); // Selects the elements with the Class name passed. It returns an NodeList array.
document.getElementsByName("Name"); // Selects the elements with the Name passed, returns a NodeList array.
document.getElementsByTagName("TagName"); // Selects the elements with the passed Tag, returns a NodeList array.
document.querySelector("#IDName or .ClassName"); // Selects the first element that matched the selector value.
document.querySelectorAll("#IDName or .ClassName"); // Selects all the element that it finds with the passed name and type. It returns a NodeList array.

// ROOT ELEMENT
console.log(document.documentElement);
Expand Down

0 comments on commit e150aed

Please sign in to comment.