W3Schools Learner's Blog

W3Schools Programming knowledge summary website

div

4/28/2018

the difference between Jquery remove() and empty()

if you don't know the difference between Jquery remove() and empty() function , i will tell you.
for example:
  1. <p>Hello</p>
  2. World
  3. <p>welcome</p> 
$('p').empty(); 
output:
<p></p>
World
<p></p> 


Execution of $("P").Empty () is the result of :
output:
World

Summary:
Jquery empty() function is clear element text, but remove() function will delete all, include element itself.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.