国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

jQuery DOM ?? detach()? ??()? ???

JQuery? ?? ??? ?? ????????. ?? ???? ?? ???? ????? ???? ??? ?? ?? ?? ??? ?????.

remove() ? detach()? ? ? ??? ? ????. ??? ??? Remove()? ? ?? ??? ?? ??? detach()? ? ?? ?? ????.

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

5.png

remove: ?? ??

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

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

detach: ?? ??

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

??()? ?? ?? ???? ???, ?? ??? ?? ?????. ?????

?: $(" p").detach()? ??? ????? ?? ??? ?????. ??? ??? ??? ?? ?? ????. ???? ?? ???? ?????. ?? ??????.

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

<html>

<head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <style type="text/css">
    p{
        border: 1px solid red;
    }
    </style>
    <script src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script>
</head>

<body>
   
    <p>元素p1,同時(shí)綁定點(diǎn)擊事件</p>
    <p>元素p2,同時(shí)綁定點(diǎn)擊事件</p>
    <h3>通過(guò)點(diǎn)擊2個(gè)按鈕后觀察方法處理的區(qū)別</h3>
    <button>點(diǎn)擊通過(guò)remove處理元素p1</button>
    <button>點(diǎn)擊通過(guò)detach處理元素p2</button>
</body>
<script type="text/javascript">
    //給頁(yè)面上2個(gè)p元素都綁定時(shí)間
    $('p').click(function(e) {
        alert(e.target.innerHTML)
    })

    $("button:first").click(function() {
        var p = $("p:first").remove();
        p.css('color','red').text('p1通過(guò)remove處理后,點(diǎn)擊該元素,事件丟失')
        $("body").append(p);
    });

    $("button:last").click(function() {
        var p = $("p:first").detach();
        p.css('color','blue').text('p2通過(guò)detach處理后,點(diǎn)擊該元素事件存在')
        $("body").append(p);
    });
</script>
</script>

</html>


???? ??
||
<html> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <style type="text/css"> p{ border: 1px solid red; } </style> <script src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script> </head> <body> <p>元素p1,同時(shí)綁定點(diǎn)擊事件</p> <p>元素p2,同時(shí)綁定點(diǎn)擊事件</p> <h3>通過(guò)點(diǎn)擊2個(gè)按鈕后觀察方法處理的區(qū)別</h3> <button>點(diǎn)擊通過(guò)remove處理元素p1</button> <button>點(diǎn)擊通過(guò)detach處理元素p2</button> </body> <script type="text/javascript"> //給頁(yè)面上2個(gè)p元素都綁定時(shí)間 $('p').click(function(e) { alert(e.target.innerHTML) }) $("button:first").click(function() { var p = $("p:first").remove(); p.css('color','red').text('p1通過(guò)remove處理后,點(diǎn)擊該元素,事件丟失') $("body").append(p); }); $("button:last").click(function() { var p = $("p:first").detach(); p.css('color','blue').text('p2通過(guò)detach處理后,點(diǎn)擊該元素事件存在') $("body").append(p); }); </script> </script> </html>