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
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.
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.
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.
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).
Here is my dirty solution:
$('#myWidget,#myWidget *').unbind().removeData();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With