Net-informations.com
SiteMap  | About    

jQuery empty() vs remove()



jQuery remove()

The jQuery remove() method will remove the selection and its contents. This method also removes data and events of the selected elements.

Use remove() method when you want to remove the element itself, as well as everything inside it. In addition to the elements themselves, all bound events and jQuery data associated with the elements are removed.

run this source code Try it Yourself

Press the button to remove this heading

Full Source

jQuery empty()

The jQuery empty() method will remove all the contents of the selection. This method does not remove the element itself, or its attributes .

In this method you can restore all data but not event handlers of removed elements from the DOM. All data and events related with elements will be removed.

run this source code Try it Yourself


Press the button to empty this heading

Full Source









net-informations.com (C) 2018    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.