Jquery Remove

Jquery remove()

This method is used to remove the selected element and its child element.

$(document).ready(function(){
 $('button').click(function(){
  $('.test').remove();
 });
});


Jquery empty()

This method is used to remove the child element of selected element.

$(document).ready(function(){
 $('button').click(function(){
  $('.test').empty();
 });
});


Jquery remove() - Filter the Element

This method allows you to filter the elements to be removed.

$(document).ready(function(){
 $('button').click(function(){
  $('p').remove('.remove');
 });
});

Share this

Related Posts