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:-
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.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>
Comparison of JQuery and 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>
...................
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....................
$("#sample_div_id")hide();
...................
...................
<div id="sample_div_id">
This Id can contain image, text or anything
</div>
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" />
<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
0 comments:
Post a Comment