Home > Article > Web Front-end > jquery uses the remove() method to delete the specified class sub-element_jquery
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.