Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Things to know in javascript and jQuery

    • 0
    • 2
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 109
    Comment on it

    Difference Between this and $(this)?
    They both refer to same element. This is used traditional sense but we add $ sign in jquery. When we use $(this), it become a jquery object.

    Comparision between bind(), live() and delegate()?
    Bind() and live() are the same but the basic difference is that bind() will not attach to those element which are added after the DOM is loaded and for this issue live() will work properly.

    live() and delegate() both can be used to those element which are added after the DOM is loaded but the problem with live() is, we can't use chaining like this:

     $("ul")children("li").find("span").live("click",function(){
       alert($(this).text());
      });
    


    We can use chaining in delegate() like this:

     $("ul")children("li").delegate("span","click",function(){
        alert($(this).text());
      });
    


    Comparision between empty(), remove() and detach()?
    empty() is used to remove all the child element and the text within that element.

    remove() is used to remove the element , everything inside that element and also all the event related to that element and the jQuery data associated with it.

    detach() is used same as remove() the only difference is that it retain all the jquery data associated with the removed element.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: