Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery remove plugin from element

Tags:

jquery

plugins

I've got something similar to the following code:

$(a).click(function() {   $(element).plugin(); }); 

Is there a way to remove a plugin from an element other than using $($.plugin).remove()? Not sure if I have the terminology correct but basically I want to reset the element to it's original state.

Thanks

like image 825
Steven Cheng Avatar asked Jul 08 '10 16:07

Steven Cheng


People also ask

How to remove an element using jQuery?

To remove elements and content, there are mainly two jQuery methods: remove() - Removes the selected element (and its child elements) empty() - Removes the child elements from the selected element.

How to remove append in jQuery?

jQuery uses: . append(); and . remove(); functions to accomplish this task. We could use these methods to append string or any other html or XML element and also remove string and other html or XML elements from the document.

How to remove an id in jQuery?

The jQuery remove() method is used to remove an element or a group of elements from the DOM. The contents of the element such as the texts and child elements are also removed. With the jQuery remove() method, it is easy to remove an element from the DOM.

Why remove function is not working in jQuery?

Your clear() function is not global because it is defined inside your document ready handler, so your onclick="clear()" can't find it. You need to either move the function outside the ready handler (making it global), or, better, bind the click with jQuery: $(document). ready(function(){ $(this).


1 Answers

Here is my dirty solution:

$('#myWidget,#myWidget *').unbind().removeData(); 
like image 121
devside Avatar answered Oct 12 '22 11:10

devside