-
empty()will remove all the contents of the selection. -
remove()will remove the selection and its contents.
<div> <p><strong>foo</strong></p> </div> $('p').empty(); // --> "<div><p></p></div>" // whereas, $('p').remove(); // --> "<div></div>"
empty() will remove all the contents of the selection.remove() will remove the selection and its contents.<div> <p><strong>foo</strong></p> </div> $('p').empty(); // --> "<div><p></p></div>" // whereas, $('p').remove(); // --> "<div></div>"
相关文章: