Friday, June 8, 2012

jQuery <=> JavaScript

A simple comparison on jQuery notations with classic JavaScript;
 
1.       How to refer to the DOM?
jQuery:
$(document)
JavaScript:
document

2.       Page Load

jQuery:
$(document).ready(function(){ … });
JavaScript:
Window.onload = function(){  … };

3.       How to refer to an element in the page by Id?
jQuery:
$(“#ELEMENT_ID”);
JavaScript:
document.getElementById(“ELEMENT_ID“);

4.       How to refer to the elements in a page by tag name?

jQuery:
$(“input”);
JavaScript:
    document.getElementsByTagName(“input”);

2 comments:

  1. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. Thank you for the comment. The like is a very useful one and is a very neatly written article. Wish to write up to the same standard one fine day.

      Delete

Please leave your comments here...