Showing posts with label document.getElementsByClassName. Show all posts
Showing posts with label document.getElementsByClassName. Show all posts

Thursday, 10 January 2013

HTML: IDs and classes

   


CSSAs I said in the last post, it's quite interesting to explore the differences between IDs and classes in CSS.

First of all, they are both selectors. But they are very different:
1) IDs are unique identifiers;
2) classes are not unique.

The above first difference is quite important because we can give a unique identifier to just one page element, while we can give a class to more than one element.

Thursday, 30 August 2012

DOM: the document.getElement[s]By

   


I can feel that the summer is almost over and it's time to get to serious things again.
In the following post, we are going to see how to manipulate the DOM elements with document.getElement[s]By.
As you may know we have different way of manipulating DOM elements and here we will see all of them:
1) document.getElementById;
2) document.getElementsByClassName;
3) document.getElementsByName;
4) document.getElementsByTagName;

As you can see there are 4 possible way of using the document.getElement[s]By[something].
Are you ready?