basic of basic

| No Comments | No TrackBacks

1) $() function is actually a factory for jQuery object. It is the object encapsulates zero or more DOM dlements.

2) .addClass() and .removeClass()
They are fairly self-explanatory.
Its only parameter is the name of the class to add or remove.

Here are two samples.

Sample 1.

$(document).ready(function() {
$('.poem').addClass('emphasized');
});


It is the function to add class 'emphasized' on the class 'poem'.

Sample 2.

$(document).ready(function() {
$('span:contains(language)').addClass('emphasized');
});

This sample try to find the span which contains "language", and add a class 'emphasized' on these span.


Related Articles

No TrackBacks

TrackBack URL: http://www.yinfor.com/mtcgi/mt-t-0912.cgi/2075

Leave a comment

About this Entry

This page contains a single entry by David Yin published on February 13, 2008 6:56 PM.

jQuery category created was the previous entry in this blog.

Solve the Trouble with a cURL request in PHP is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

OpenID accepted here Learn more about OpenID
Powered by Movable Type 4.21-en

Online Tools