欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

jQuery之empty() VS. remove()

程序员文章站 2022-07-05 23:42:24
...
jQuery empty() vs remove()


What's the difference between empty() and remove()methods in jQuery, and when we call any of these methods, the objects being created will be destroyed and memory released?


----------------------------------------------------------------------------------

- empty() will remove all the contents of the selection.

- remove() will remove the selection and its contents.


Consider:
<div>
    <p><strong>foo</strong></p>
</div>

//

$('p').empty();  // --> "<div><p></p></div>"

// whereas,

$('p').remove(); // --> "<div></div>"







-

jquery-empty-vs-remove
http://*.com/questions/3090662

















---








-