Destroying a jQuery UI Plugin - J Query

Problem
You’re done with a particular plugin, and you want your element back the way it was. This is bigger than disable; this is un-init.

Solution
Call the destroy method:

Discussion
Calling the destroy method will completely un initialize that element as that plugin. It will remove any classes added by the init or any later method call or event. If the init caused the element to be wrapped, it will unwrap. It’s like a big undo.
Destroying a jQuery UI plugin doesn’t remove the element from the DOM. It simply removes that plugin state saved on that element, putting the element back as close as possible to its pre-init state. After a jQuery UI plugin is destroyed, it can be initialized as the same again.
If you want to both destroy and remove a plugin element, you can simply call .remove(). The destroy method will be called automatically by jQuery UI as it’s removed. This is true even if the element has been initialized as more than one jQueryUI plugin.


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

J Query Topics