The jQuery is start with document ready event which is contain by Script tag. All jQuery code is written in script tag.
The $(document).ready(handler) statement is called ready event. The handler is a function
that execute only when if document is ready to be manipulated.
<script type="text/javascript">
$(document).ready(function(){
// jQuery methods go here...
});
</script>
You can also write following code if you don't want document ready event.<script type="text/javascript">
$(function(){
// jQuery methods go here...
});
</script>
The jQuery code start with the dollar sign ($) and ends with a semicolon (;).
The syntax of jQuery code is following: $(selector).action();
The exaplanation of jQuery syntax is following.A $ sign to define jQuery.
A (selector) to "query (or find)" HTML elements.
A jQuery action() to be performed on the element(s).
There are following examples of jQuery code.
$(this).hide() - hides the current element.
$("a").hide() - hides all <a> elements.
$(".first").hide() - hides all elements with class="first".
$("#first").hide() - hides the element with id="first".
