Web Development Ninjas Question:
Download Questions PDF

Tell me what is the difference between detach() and remove() methods in jQuery?

Ninjas Web Developer Interview Question
Ninjas Web Developer Interview Question

Answer:

Though both detach() and remove() methods are used to remove a DOM element, the main difference between them is that detach() keeps track of the last element detached, so that it can be reattached, while the remove() method does keep a reference of the last removed method. You can also take a look at the appendTo() method for adding elements into DOM.

Download Ninjas Web Developer Interview Questions And Answers PDF

Previous QuestionNext Question
Tell me what purpose do Work Workers serve and what are some of their benefits?Do you know what are the new image elements in HTML5?