jQuery remove elements of the method remove () empty ()

jQuery remove elements of the method remove () empty ()

<div id="div1" style="height:100px;width:300px;border:1px solid black;background-color:yellow;">

<p>www.96net.com.cn</p>

</div>

1, remove elements of the method remove () usage

     $("#div1").remove();

2, jQuery empty () method removes the child element of the selected element

$("#div1").empty();

 

Filter removed element
jQuery remove () method also accepts a parameter that allows you to filter elements erased.

This parameter can be any jQuery selector syntax.

The following examples delete class = "italic" all <p> element:

Guess you like

Origin www.cnblogs.com/96net/p/12583721.html