onsdag den 25. februar 2015

Searching for DOM elements

From the site http://javascript.info/tutorial/searching-elements-dom we get this summary
There are 5 main ways of querying DOM:
  1. getElementById
  2. getElementsByTagName
  3. getElementsByName
  4. getElementsByClassName (except IE<9)
  5. querySelector (except IE<8 and IE8 in compat mode)
All of them can search inside any other element. All of them excepts the last one return live collections.

XPath is kind-of supported in most browsers, but very rarely used.

Ingen kommentarer:

Send en kommentar