Unbind - Remove - Kill a jQuery plugin

前端 未结 3 1736
野性不改
野性不改 2020-12-10 02:37

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

相关标签:
3条回答
  • 2020-12-10 02:57
    $("#selector").unbind().removeData(); 
    
    0 讨论(0)
  • 2020-12-10 03:00

    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.

    0 讨论(0)
  • 2020-12-10 03:01

    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.

    0 讨论(0)
提交回复
热议问题