how can I overload or extend (or intercept) jQuery's .html() method so that it works its default way unless the object has a certain class?
Thanks
You just overwrite the function while maintaining a reference to the original.
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);
});
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With