tsiokos
tsiokos

Reputation: 1090

Unbind - Remove - Kill a jQuery plugin

Is there a way to "unbind" a jQuery plugin from a jquery selector?

Upvotes: 19

Views: 27772

Answers (3)

anguswild
anguswild

Reputation: 323

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

Upvotes: 2

reko_t
reko_t

Reputation: 56470

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.

Upvotes: 12

Guffa
Guffa

Reputation: 700910

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.

Upvotes: 5

Related Questions