jquery USES the remove of method to delete the specified class child element

  • 2020-05-19 04:05:13
  • OfStack

This example shows how jquery USES the remove() method to remove the specified class child element. Share with you for your reference. The specific implementation method is as follows:


<!DOCTYPE html>
<html>
<head>
<script src="js/jquery.min.js">
</script>
<script>
$(document).ready(function(){
 $("button").click(function(){
  $("p").remove(".italic");
 });
});
</script>
</head>
<body>
<p>This is a paragraph in the div.</p>
<p class="italic"><i>This is another paragraph in the div.</i></p>
<p class="italic"><i>This is another paragraph in the div.</i></p>
<button>Remove all p elements with class="italic"</button>
</body>
</html>

I hope this article has been helpful to your jQuery programming.


Related articles: