Javascript Library jquery

For past few days I was playing around with this javascript library jquery which is really light and powerful.
This was told by Nishanth from our company. He is a great fan of this tool and even I am one now.

http://jquery.com/

Some of examples to use this library

$(“p.surprise”).addClass(“ohmy”).show(“slow”);

The selectors are really powerful and makes life very easier. Samples

Hide all Paragraph elements that contain a link:

$(“p[a]”).hide();

Show the first paragraph on the page:

$(“p:eq(0)”).show();

Hide all divs that are currently showing:

$(“div:visible”).hide();

Get all list items that are children of an unordered list:

$(“ul/li”)
/* valid too: $(“ul > li”) */

Get all Paragraphs, with a class of ‘foo’, that have a link in them:

$(“p.foo[a]”);

Get list item that contains link with “Register” text inside:

$(“li[a:contains(‘Register’)]”);

Get the input field’s value with the name of ‘bar’:

$(“input[@name=bar]”).val();

All checked radio buttons:

$(“input[@type=radio][@checked]”)

By Imthiaz

Programmer, SAAS, CMS & CRM framework designer, Love Linux & Apple products, Currently addicted to mobile development & working @bluebeetle

1 comment

Comments are closed.