How can I remove a function from a jquery object? For example, I have
$('#element').func = function() {
// function body goes here
}
And later on I want to remove func
from $('#element')
. I've tried delete
but it doesn't work. Thanks.
How can I remove a function from a jquery object? For example, I have
$('#element').func = function() {
// function body goes here
}
And later on I want to remove func
from $('#element')
. I've tried delete
but it doesn't work. Thanks.
How about this?
$('#element').fn.func = null;
or
$('#element').prototype.func = null;
or
delete $('#element').fn.func;
or
delete $('#element').prototype.func;
For understanding what the prototype is, have a look here: How does JavaScript .prototype work?