Home  >  Article  >  Web Front-end  >  jquery uses the remove() method to delete the specified class sub-element_jquery

jquery uses the remove() method to delete the specified class sub-element_jquery

WBOY
WBOYOriginal
2016-05-16 16:07:201209browse

The example in this article describes how jquery uses the remove() method to delete child elements of a specified class. Share it with everyone 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 will be helpful to everyone’s jQuery programming.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn