How to get rid of extended $.extend()
function from a specific target object. Example: By reloading parts of the DOM with XHR, I'm able to detect the appearance of the object like this:
// Initliaize:
$('#sausage').catsup();
...
// Inside fn.catsup():
if($('body').find($(this)).size() == 0) // object has gone
But how can I kill fn.catsup()
? This seems not to work:
$(this).clearQueue();
$(this).stop();
$(this).unbind();
delete $(this);
How to get rid of extended $.extend()
function from a specific target object. Example: By reloading parts of the DOM with XHR, I'm able to detect the appearance of the object like this:
// Initliaize:
$('#sausage').catsup();
...
// Inside fn.catsup():
if($('body').find($(this)).size() == 0) // object has gone
But how can I kill fn.catsup()
? This seems not to work:
$(this).clearQueue();
$(this).stop();
$(this).unbind();
delete $(this);
catsup
you will have to write another function (even better add a method to catsup itself) that will do so.
– m90
Commented
Mar 28, 2012 at 10:49
If I understood the question, you want to remove your function from jQuery.
use this:
$.fn.catsup = null;
Or as suggested by @Matt:
delete $.fn.catsup
Unless I understood it wrongly, you simply want catsup
to not be part of jQuery extension functions anymore:
delete $.fn.catsup;
Note that this will not affect all jQuery DOM objects, i.e. both existing ones and those created afterwards.