jQuery Chaining


/ Published in: JavaScript
Save to your folder(s)

Use chaining in jQuery to reduce the code size and gain better performance.


Copy this code and paste it in your HTML
  1. var $active_light = $('#traffic_light input.on');
  2. $active_light.bind('click', function(){...})
  3. .css('border', '3px dashed yellow')
  4. .css('background-color', 'orange')
  5. .fadeIn('slow');

URL: http://www.artzstudio.com/2009/04/jquery-performance-rules/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.