Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


What is the difference between .empty(), .remove() and .detach() methods in jQuery?



What is the difference between .empty(), .remove() and .detach() methods in jQuery?..

Answer / chaitanya

All these methods .empty(), .remove() and .detach() are used for removing elements from DOM but they all are different.

.empty(): This method removes all the child element of the matched element where remove() method removes set of matched elements from DOM.

.remove(): Use .remove() 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.

.detach(): This method is the same as .remove(), except that .detach() keeps all jQuery data associated with the removed elements. This method is useful when removed elements are to be reinserted into the DOM at a later time.

Find out more here

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More jQuery Interview Questions

How to disable/enable an element with jQuery?

0 Answers  


Tell me how to check if number is numeric while using jquery 1.7+? : jquery mobile

0 Answers  


Is numeric in jquery?

0 Answers  


Can you give me a brief history of your programming days? Where did it all start?

0 Answers  


What is the use of queue() in jquery?

0 Answers  


Why do we use jQuery?

1 Answers  


Explain the difference between size and length of jquery?

0 Answers  


How do you update ajax response with id " resilts"?

0 Answers  


How to write browser specific code using jquery? : jquery mobile

0 Answers  


How to load a page using jquery mobile? : jquery mobile

0 Answers  


What is the difference between jquery.get() and jquery.ajax()?

0 Answers  


What is the difference between calling stop(true,true) and finish method?

1 Answers  


Categories