开发者

Unbind - Remove - Kill a jQuery plugin

Is there a way to "unbind" a jQuery plugin from a jquery s开发者_如何学Celector?


You can unbind the plugin name from the jQuery prototype object with delete:

delete $.fn.pluginName;

This doesn't affect already initialized plugin instances though.


Generally no.

The plugin typically makes changes to the elements that you apply it to. Sometimes those can simply be undone by removing the attributes or unbinding the events that the plugin added, but the plugin would need to provide this functionality, or you would have to know exactly what to remove.

Sometimes plugins overwrite information so that you can't undo it without knowing what the information was before the plugin was applied.


$("#selector").unbind().removeData(); 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜