Over a million developers have joined DZone.

Jquery Examples

DZone's Guide to

Jquery Examples

Free Resource
// description of your code here

some cool shortcuts in jquery to get started with it .. 


// Makes each odd tr element to have a blue backcolor
$("tr:odd").css("background-color", "blue");

// What if we want to make the header row have a different look ? Show Me
$("#results tr:first").css("background", "black");
$("#results tr:first").css("color", "white");
$("#results tr:first").css("font-weight", "bold");

// We also could have assigned a class name to the header tr element like this 
$("#results tr:first").addClass("header");

//All span that are inside a div element (may not be immediate child of the div) will be selected.
$("div span").css("border", "1px solid");

//Here is how we select the links that are descendent of span which are direct children of a div
$("div > span a")

//Here is how we can select a div with id mydiv 

// Here is how we select all links under div elements that have css class set to mycss
$("div.mycss a")

// if we want to find a link that points to http://www.google.com then we would write

// Modifications

Hi There!

"); $("#mytable").wrap("
"); // How to replace all hr elements (horizontal line) with a br element $("

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}