在 jQuery 官網的文件中提到: - .empty(): This method removes not only child (and other descendant) elements, but also any text within the set of matched elements.
意即,移除你元素底下所有文字內容以及子元素 - .remove(): Similar to
.empty() , the .remove() method takes elements out of the DOM.
意即,除了.empty()原有行為外,指定的selector也會被移除 - .detach(): The
.detach() method is the same as .remove() , except that .detach() keeps all jQuery data associated with the removed elements.
意即,除了.remove()原有行為外,連原本綁定在裡面的事件都一併移除 |