Google News
logo
jQuery - Interview Questions
What is chaining in jQuery?
Chaining is a  powerful feature of jQuery. Chaining means specifying multiple functions and/or selectors to an element.
 
Chaining reduces the code segment and keeps it very clean and easy to understand. Generally chaining uses the jQuery built in functions that makes compilation a bit faster.
 
By using chaining we can write the above code as follows :  

$(document).ready(function() {  
    $("#div2").html($("#txtBox").prop("readonly")) + '</br>';  
    $("#div3").html($("#txtBox").attr("readonly"));  
});  
Advertisement