JQuery Selector

Posted by Jeffye | 10:31 PM

addClass() adds a specified class to an element. 

$('a[href^="http://"]').addClass('externalLink');
This code would take HTML like this:
<a href="http://www.oreilly.com/">
And change it to the following:
<a href="http://www.oreilly.com/" class="externalLink">

removeClass() is the opposite of addClass()

$('#alertBox') //id

$('.alertBox') //class

$('body') //tag

0 comments

Popular Posts

无觅相关文章插件,迅速提升网站流量