Hi All, In this chapter we are learn some basics, So here we go
A jQuery statement starts with the dollar sign ($) and ends with a semicolon (;) in the which is in document ready function. $ sign defines the jQuery,
Document Ready -
All jquery code is written in ready function document ready means jQuery code from running before the document or page is finished loading (DOM clear)
$(document).ready(function(){
//code will here
});
All code will appeare in script tag -
<script type="text/javascript"></script>
jQuery Syntax -
jQuery syntax has two major thing first for selecting HTML elements and second perform some action on the element(s).
$(selector).action()
For example :-
$("this").hide()
Hiding current(this) element.
$("p").hide()
Hiding all <p> elements.
$(".div1").hide()
Hiding whose class=".div1" in the elements.
$("#div1").hide()
Hiding whose id="div1" in the elements.
Example of syntax flow of jQuery -
<script type="text/javascript">
$(document).ready(function(){
$("div").click(function(){
$(this).hide();
});
});
</script>
0 Comment(s)