Introduction to JQuery

JQuery is a JavaScript library supported by multi browser. By using jquery we can do the things like Finding controls, applying styles, bind or unbind events, applying animations and much more very easily.

In JavaScript we will find the controls by using document.getElementById("controlid"). In JQuery we can find the controls in different ways like by using it's id, class name, tag name.

You can download the latest JQuery version from Jquery.com


Finding control by its id

Use "#" before the control id. example $("#controlid")

Sample :

<script language="javascript"> function getValUsingJQuery() { alert($("#txtSample").val()); } </script>


Finding control by its class name

Use "." before the control class name. example $(".classname")


Sample :

<script language="javascript"> function getValUsingClass() { alert($(".clstextbox").val()); } </script>

Finding control by its tag name


Use tag name to find the control. example $("tagname")

Sample :

<script language="javascript"> function getValUsingTag() { alert($("input:text").length); } </script>