====== Advanced jQuery Techniques ====== ==== Chaining Methods ==== $("#box").css("color", "red").slideUp(1000).slideDown(1000); ==== Deferred Objects and Promises ==== $.when($.ajax("https://api.example.com/data"), $.ajax("https://api.example.com/info")) .done(function(response1, response2) { console.log("Both requests completed successfully"); }) .fail(function() { console.log("An error occurred"); }); ==== Performance Optimization Tips ==== * **Use Event Delegation:** $("#parent").on("click", "button", function() { alert("Efficient event handling!"); }); * **Minimize DOM Manipulations: Store selections in variables.** var $box = $("#box"); $box.css("background", "blue").fadeIn(500); * **Use ''.data()'' Instead of ''.attr()'' for Performance** $("#element").data("key", "value");