| 1. |
Can You Give An Example For Chaining Along With Code Snippet? |
|
Answer» Below is the sample code SNIPPET: Old Code: $(document).ready(function(){ $('#MyControlID').addClass('test'); $('#MyControlID').css('color', 'yellow'); $('#MyControlID').fadeIn('fast'); }); New Code after CHAINING: $(document).ready(function(){ $('#MyControlID').addClass('test') .css('color', 'yellow') .fadeIn('fast'); }); Below is the sample code snippet: Old Code: $(document).ready(function(){ $('#MyControlID').addClass('test'); $('#MyControlID').css('color', 'yellow'); $('#MyControlID').fadeIn('fast'); }); New Code after chaining: $(document).ready(function(){ $('#MyControlID').addClass('test') .css('color', 'yellow') .fadeIn('fast'); }); |
|