137
rated 0 times
[
138]
[
1]
/ answers: 1 / hits: 37107
/ 14 Years ago, mon, december 27, 2010, 12:00:00
Is there way to override jQuery's core functions ?
Say I wanted to add an alert(this.length) in size: function()
Instead of adding it in the source
size: function() {
alert(this.length)
return this.length;
},
I was wondering if it would be possible to do something like this :
if (console)
{
console.log(Size of div = + $(div).size());
var oSize = jQuery.fn.size;
jQuery.fn.size = function()
{
alert(this.length);
// Now go back to jQuery's original size()
return oSize(this);
}
console.log(Size of div = + $(div).size());
}
More From » jquery