Tuesday, February 16, 2010

Jquery Basics

Lesson from link-->http://www.catswhocode.com/blog/learning-jquery-the-basics


1>$(document).ready(function() {});

in jquery is same as

window.onLoad() in javascript

2>$('.comments')

if you use 'p' instead '.coments' then jquery will find all paragraphs.
Same thing for CSS just use '#' instead '.'

3>$('.comments').addClass('stripe');

Stripe would add gray background to comments.
Another example-->$('.comments:odd').addClass('stripe');

4>$('.comments').mouseOver(function() {
$('this').addClass('hover');
});

Remove class on mouseover.
Another example like this-->
$('comments').mouseOut(function() {
$('this').removeClass('hover');
});

No comments:

Post a Comment