亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

jQuery DOM ?? ??

Remove? ??? ????? ??? ???? ????? ??? ?? ??? ??? ??? ???? ??? ? jQuery ???? ???? ?? ??? ?? ?? ?????.

?? ?? ??? ?? ?? ???? ??????

<div class="hello">
    <p>php中文網(wǎng)</p>
</div>
$('.hello').on("click",fn)

remove ???? ???? ?? ? ??? ???? ?? ??? ?? ????? ??? ???? ????? ???. ?? "???"? ???? ?? ????. ??"??? ????? ???? ??? ???? ? ? ?? ??? ????, ???? ?? ?? ??? ?????

remove ???? ?? div? ? ?? ?? ??? ???????. ??? ?? ???? ???? ?????.

//通過remove處理
$('.hello').remove()
//結(jié)果:<div class="hello"><p>php中文網(wǎng)</p></div> 全部被移除
//節(jié)點(diǎn)不存在了,同事事件也會(huì)被銷毀

remove ??? ????? ???? ?? ?? ?????.

?? ?? ??? ??? ??? ??? ???? ???? ??? ?? ?? ??? ???? ? ?? ????? ??? ? ??? ????. ??? ??

$()? ???? ??? ??? ??? ??? ?? ??()? ?? ??? ??? ???? ??? ?? ??? ? ????

??? ?? ??? ???? ??? ??? ? ????

$("p").filter(":contains('3')").remove()

??? ?? ??? ??? ?????. ??

<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <title></title>
    <script src="http://lib.sinaapp.com/js/jquery/1.9.1/jquery-1.9.1.min.js"></script>
    <style>
    .test1 {
        background: #bbffaa;
    }
    
    .test2 {
        background: yellow;
    }
    </style>
</head>

<body>
    <h2>通過jQuery remove方法移除元素</h2>
    <div class="test1">
        <p>p元素1</p>
        <p>p元素2</p>
    </div>
    <div class="test2">
        <p>p元素3</p>
        <p>p元素4</p>
    </div>
    <button>點(diǎn)擊通過jQuery的empty移除元素</button>
    <button>點(diǎn)擊通過jQuery的empty移除指定元素</button>
    <script type="text/javascript">
    $("button:first").on('click', function() {
        //刪除整個(gè) class=test1的div節(jié)點(diǎn)
        $(".test1").remove()
    })

    $("button:last").on('click', function() {
        //找到所有p元素中,包含了3的元素
        //這個(gè)也是一個(gè)過濾器的處理
        $("p").remove(":contains('3')")
    })
    </script>
</body>

</html>


???? ??
||
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <title></title> <script src="http://lib.sinaapp.com/js/jquery/1.9.1/jquery-1.9.1.min.js"></script> <style> .test1 { background: #bbffaa; } .test2 { background: yellow; } </style> </head> <body> <h2>通過jQuery remove方法移除元素</h2> <div class="test1"> <p>p元素1</p> <p>p元素2</p> </div> <div class="test2"> <p>p元素3</p> <p>p元素4</p> </div> <button>點(diǎn)擊通過jQuery的empty移除元素</button> <button>點(diǎn)擊通過jQuery的empty移除指定元素</button> <script type="text/javascript"> $("button:first").on('click', function() { //刪除整個(gè) class=test1的div節(jié)點(diǎn) $(".test1").remove() }) $("button:last").on('click', function() { //找到所有p元素中,包含了3的元素 //這個(gè)也是一個(gè)過濾器的處理 $("p").remove(":contains('3')") }) </script> </body> </html>