Chaining is a great feature in jQuery that allows you to chain method calls. Here is an example:


$('sampleElement').removeClass('classToBeRemoved').addClass('classToBeAdded');
 

You can also use jQuery to store state information of DOM elements in your web page. It contains the data() method that you can use to store state information of the DOM elements in key/value pairs. Here is an example:


$('#someElement').data('currentState', 'off');
 
Tagged: