您只需覆盖该功能,同时保持对原始的引用.
var jq_html_function = $.fn.html;
$.fn.html = function() {
$(this).each(function() {
if($(this).hasClass('someclass')) {
// Do something
return;
}
jq_html_function.apply(this, arguments);
});
};
Run Code Online (Sandbox Code Playgroud)