Friday, November 19, 2010

Class (.tagclass)

Select all elements that have a class of 'tagclass'.
Examples
1- $('.tagclass') selects all elements that have a class of tagclass
2- $('p.tagclass') selects all paragraphs that have a class of tagclass
3- $('.tagclass.otherclass') selects all elements that have a class of both tagclass and otherclass

For class selectors, jQuery uses JavaScript's native getElementsByClassName() function if the browser supports it. Otherwise, it checks the .className attribute of each element.

No comments:

Post a Comment