Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • What is chaining in jQuery?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 174
    Comment on it

    Hello Readers,

    In jquery chaining is the technique and most poweful feature. It means we chain the one or more methods or events to one selectors or elemnts.

    Because of this it short the code level as well as its performance (means it gives betttr performance).

    When we use the chaining into the jquery code we start from left to right . So, the left most will be considered first in jquery chaining.

    Using this browers do not have to find the same elemnet again and again (means not find more than once).

    Code Example :

    $(document).ready(function(){
        $('#dvContent').addClass('dummy');
        $('#dvContent').css('color', 'red');
        $('#dvContent').fadeIn('slow');
    });
    

    Above jQuery code sample can be re-written using chaining.

    $(document).ready(function(){
        $('#dvContent').addClass('dummy')
              .css('color', 'red')
              .fadeIn('slow');     
    });
    

 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: