javascript - Remove extended function - Stack Overflow

How to get rid of extended $.extend() function from a specific target object. Example: By reloading par

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);
Share Improve this question edited Mar 28, 2012 at 10:56 gdoron 150k59 gold badges302 silver badges371 bronze badges asked Mar 28, 2012 at 10:33 mate64mate64 10.1k17 gold badges66 silver badges98 bronze badges 3
  • 2 What do you mean by 'kill catsup()'? – Flash Commented Mar 28, 2012 at 10:36
  • 1 @msec. Now I'm even more confused, what are you trying to do? Can you give us the context? it's very hard to understand the question. – gdoron Commented Mar 28, 2012 at 10:42
  • If you want a way to "destroy" the actions done by 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
Add a ment  | 

2 Answers 2

Reset to default 7

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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745284670a4620488.html

相关推荐

  • javascript - Remove extended function - Stack Overflow

    How to get rid of extended $.extend() function from a specific target object. Example: By reloading par

    2小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信