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

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 122
    Comment on it

    Chaining in jQuery means allowing multiple function/ selectors to an element in the web page.


    Example-

    $(document).ready(function(){
    $('#mybox').css('font', '10px');
    $('#mybox').addClass('new');
    $('#mybox').fadeIn('slow');
    });


    By using chaining we can write above code as-

    $(document).ready(function(){
    $('#mybox').css('color', '10px').addClass('new').fadeIn('slow');
    });


    Note:-

    • Advantage of chaining is that we can mange our code in a simple and short manner.
    • The script execution becomes faster because the element will search only single time to perform multiple operation.

 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: