jquery remove() method


  Translation results:

remove

UK[rɪˈmu:v] US[rɪˈmuv]

vt.Remove; expel; take off, take off; migrate

vi.Migrate, move; leave

n.Distance, gap; move

jquery remove() methodsyntax

Function: remove() method removes the selected elements, including all text and child nodes. This method does not remove the matching elements from the jQuery object, so the matching elements can be reused in the future. But remove() does not preserve the element's jQuery data, except for the element itself. Others such as bound events, additional data, etc. will be removed. This is different from detach().

Syntax: $(selector).remove()

jquery remove() methodexample

<html>
<head>
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $("button").click(function(){
    $("p").remove();
  });
});
</script>
</head>
<body>
<p>这是一个段落。</p>
<p>这是另一个段落。</p>
<button>删除所有 p 元素</button>
</body>
</html>
Run instance »

Click the "Run instance" button to view the online instance

Popular Recommendations

Home

Videos

Q&A