Explain how jQuery works?Breafly

The $() function is an alias for the jQuery() function . This returns a special Java-Script object. This JavaScript Object contains an array of  DOM elements that matches the selector. Selector is key thing in jQuery development.It is away to select node from DOM. This Java-Script object possesses a large number of useful predefined methods that can action group of elements.This type of construct is termed a wrapper because it wraps the matching element(s) with extended functionality.
  • Here $(object) is called jQuery wrapper around the object.
  • jQuery has a ready element that checks the document and waits until document is ready to be manipulated.
  • It searches for the reference files for framework, once it finds it then control goes to the function specified.
  • What ever code mentioned in the function that gets executed. Event handling also can be implemented here.
Consider the following example.
view sourceprint?
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
    // Your code here
      alert(“Checking function Fired”);
}
) ;
</script>
</head>
<body>
<a href="http://www.challlengebrains.blogspot.com /">Beyond Relational jQuery FAQ </a>
</body>
</html>
view sourceprint?
1.<strong><em>Note :We can also use jQuery(document) instead of $. </em></strong>
  • You can debug the jquery script by placing debugger keyword (OR) attaching worker process and then inserting a break point .

0 comments:

Post a Comment