Tuesday 19 July 2011

Jquery -simplified js

In this article,let us see how we can use jquery in the place of  java script and minimize the lines of code.

Case 1:

let us say,your form has 100 input text fields and you have a use case clearing the values on click of reset button .This can be easily acheived using jquery as below where :input is the selector to select all input types









Case 2:

let's say you need the value selected in the group of  radio buttons ,let us consider the radio buttons name is gender














Case 3:


Lets take a use case where you have a number of check boxes which may need to be check or un-check at a single shot,this can be easily achieved as below















All the above stuff can be achieved using js but not that easily as in jquery.for more selectors refer JQUERY SELECTORS



cheers..... :-)

No comments:

Post a Comment