Web Development Ninjas Question:

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

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 PDF Read All 58 Ninjas Web Developer Questions
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?