Skip to content Skip to sidebar Skip to footer

JQuery Introduction


JQuery:-
     JQuery is nothing but this is created fully using JavaScript, this script are generated by Javascript methods but its written using very simply. So it is very speed and can understand very easier. But before using this JQuery we need to import a the jQuery package to your program using the <Script Src="..."></script> tag.

Importing JQuery:-
  <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>

The above code is import your JQuery package from internet you can download this code and import from your server too. This will update day to day.

Comparison of  JQuery and JavaScript:-

JQuery Vs JavaScript



Hide a div using JavaScript:-
...................
...................
document.getElementById('sample_div_id').style.display = "none";
...................
...................

<div id="sample_div_id">
   This Id can contain image, text or anything
</div>

Hide a Div Using JQuery:-
...................
...................
$("#sample_div_id")hide();
...................
...................

<div id="sample_div_id">
   This Id can contain image, text or anything
</div>
So the Jquery is very easy to remember and speed is better than JavaScript.


Example Program:-
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script type="text/javascript">
function show_div()
{
 $("#ads_div").show();
}
function hide_div()
{
$("#ads_div").hide();
}

</script>
<div id="ads_div">
This is the Advertisement
</div>
<input onclick="show_div();" type="button" value="Show Div Content" />
<input onclick="hide_div();" type="button" value="Hide Div Content" />

Output:-
This is the Advertisement



Post a Comment for "JQuery Introduction"