【www.gdgbn.com--jquery】

selectora选择过滤表达式匹配的元素的集合被删除。

html:


  hello
  goodbye

we can target any element for removal:

$(".hello").remove();this will result in a dom structure with the element deleted:


  goodbye

代码如下:

$("div").remove(".hello");this would result in the same dom structure:


  goodbye

看个实例




 
  <script src="http://code.jquery.com/jquery-latest.min.js"></script>


 

hello


  how are
 

you?


 
<script>
    $("button").click(function () {
      $("p").remove();
    });

</script>


本文来源:http://www.gdgbn.com/wangyezhizuo/26895/