Contact for Expert ServicesAdvertise with Ecomspark.

Jquery brief Introduction – Basic of Jquery

Jquery is light weight, fast and feature rich client side java script library used to do Dom manipulation, UI styling, and Ajax interaction etc. Its built on JavaScript language.

its not an alternative to Javascript. Jquery is not a language its a library built on JavaScript.
Advantages of J query –
– Easy to use
– Ajax capabilities
– Large pool of inbuilt methods
– easy to use Dom manipulation and traversal

Difference –
Jquey is library built on java script and JavaScript is programming language.
No, jquery is not JavaScript replacement.  Jquery does not follow any w3c recommendations.
jquery execute when dom is ready –
$(document).ready(function()
{
});

$ is an alias for jquery, we can replace it by our choice too like
jquery(document).ready(function()
{

});

We can use multiple document ready function on same page for different manipulation. We can also use other js libraries with jquery. We used jQuery.noConflict() to replace $ sign in jquery. We use this when used another library with jquery because other library also can use $ sign so not to have conflict jQuery.noConflict should be used,
Eg-
var $j = jQuery.noconflict();
$j(document).ready(function()
{
});

Diff between body onload() and document.ready in jquery?

1- document.ready can be used multiple time in a page but body onload() can be used only once.
2- document.ready executes when Dom is ready but body onload() executes when everything is loaded on page.

jquery comes in 2 different versions production and deployment. Deployment version also know as minified veriosn . .js and .min.js both are same in functionality only size matters.

jquery selectors –

To do the Dom manipulation we need elements and need to find them. We used jquery selector to find HTML elements-

1- name selector – select all element which match given name.
2- class selector – select all element with given class name, $(“.classname”)
3- id selector -select 1 element which match the given id $ (“#nid”)
4- * selector – select all element – $(“div”)

keep in mind – last selector always executed first.

Eg- $(“p#elmid .myclass”);

jquery will find all element with class name myclass and then it will reject all element which are not in “p#elmid”

Note – JavaScript is fast than jquery because jquery is written on javascript so jquery called javascript function before execution.
For eg –
document.getElementByID(‘name’) or (“#name”) in this document.getElementByID will execute first because jquery will internally call document.getElementByID(‘name’) function first.

Visit jquery selectors and methods

Tags:

Add a Comment

Your email address will not be published. Required fields are marked *

Translate »