// create a reference to the old `.html()` function var htmlOriginal = $.fn.html; // redefine the `.html()` function to accept a callback $.fn.html = function(html,callback){ // run the old `.html()` function with the first parameter var ret = htmlOriginal.apply(this, arguments); // run the callback (if it is defined) if(typeof callback == "function"){ callback(); } // make sure chaining is not broken return ret; }