This article introduces jQuery remove() to filter deleted elements through example code. The jQuery remove() method also accepts a parameter, allowing you to filter deleted elements. Friends who need it can refer to it. I hope it can Help everyone.
The jQuery remove() method also accepts a parameter, allowing you to filter deleted elements.
This parameter can be any jquery selector syntax.
The following example deletes all <p>
elements with class="italic"
:
##
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="https://cdn.bootcss.com/jquery/1.10.2/jquery.min.js"> </script> <script> $(document).ready(function(){ $("button").click(function(){ $("p").remove(".italic"); }); }); </script> </head> <body> <p>这是一个段落。</p> <p class="italic"><i>这是另外一个段落。</i></p> <p class="italic"><i>这是另外一个段落。</i></p> <button>移除所有 class="italic" 的 p 元素。</button> </body> </html>
The difference between remove() and detach() in jquery
Analysis of the remove() and detach() functions in jquery Differences in usage
<p> Detailed explanation of jQuery.remove() function usageThe above is the detailed content of Detailed explanation of jQuery remove() filtering deleted elements. For more information, please follow other related articles on the PHP Chinese website!