Saturday 13 July 2013

Different ways to work with jQuery...

->First we have to download/copy JQuery code(In this blog already link is available).
->Place that code in one text file and save with the extension .js(Ex->jquery.js)
->create one html file and give this jquery.js file path in script tag(<script src="jquery.js"></script>)
->write jquery code in the script tag
->We can use following ways to work with JQuery
   
$(document).ready(function(){

         alert("WELCOME TO JQUERY");
         //write JQuery code here

});
jQuery(document).ready(function() {

         alert("WELCOME TO JQUERY");
         //write JQuery code here

});
window.jQuery(document).ready(function() {

         alert("WELCOME TO JQUERY");
         //write JQuery code here

});
window.$(document).ready(function() {

         alert("WELCOME TO JQUERY");
         //write JQuery code here

});
$(function() {

         alert("WELCOME TO JQUERY");
         //write JQuery code here

});
jQuery(function() {

         alert("WELCOME TO JQUERY");
         //write JQuery code here

});
//We can use any name instead of $
var ram=$.noConflict();
ram(document).ready(function() {

         alert("WELCOME TO JQUERY");
         //write JQuery code here

});
var ram=$.noConflict();
ram(function() {

         alert("WELCOME TO JQUERY");
         //write JQuery code here

});
var ram=$.noConflict();
window.ram(document).ready(function() {

         alert("WELCOME TO JQUERY");
         //write JQuery code here

});
var ram=$.noConflict();
window.ram(function() {

         alert("WELCOME TO JQUERY");
         //write JQuery code here

});

EXAMPLE PROGRAM
<html>
<head>
<script src="jquery.js">
</script>
<script>
    $(document).ready(function() {
         alert("AFTER LOAD THE PAGE THIS JQUERY CODE IS EXECUTING");
         //WRITE ANY JQUERY CODE
    });
</script>
</head>
<body>
HOW TO WORK WITH JQUERY
</body>
</html>