11/14/2013 - 4:25 AM

Basics. Source:

//Add a CSS class to a specific element

//Removing a CSS class from a specific element

//Check if a specific element has a CSS class

//Switch CSS using jQuery
$('link[media='screen']').attr('href', 'Alternative.css');

//Append HTML to an element

if ($('img').length) {
    log('We found img elements on the page using "img"');
} else {
    log('No img elements found');

//Get the parent element of an element
var id = $("button").closest("div").attr("id");

//Get element siblings

//Remove an option from a select list
$("#selectList option[value='2']").remove();

//Get the selected option as text
$('#selectList :selected').text();

//Apply a “zebra” effect on tables

//Count children of an element
$("#foo > div").length