jquery remove plugin from element jquery remove plugin from element jquery jquery

jquery remove plugin from element


Here is my dirty solution:

$('#myWidget,#myWidget *').unbind().removeData();


You'd have to know what the plugin does in order to reverse it's effects. Many plugins add extra elements to the DOM, handlers to elements, etc. If the plugin doesn't create any extra elements, you might be able to simply do a clone (without data and events) and replace or even just unbind all event handlers, but that's not always going to be effective. It would be very dependent on the plugin in question.


Unless the plugin provides that functionality, it probably can not be done that easily. You'll have to investigate what the plugin does, and specifically undo those things - or store a clone of the non-plugged-in element to replace it with later.