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

jQuery DOM ?? ??

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

??? ???? ???? ????? ???? ????. ????? ?? ???? ???? ???. ??? ??? ???? ?????. ???? ??? ??? ??? ?? ??? ?? ????.
???? ?? ??? ???? ?? ??? ??? ???? ?? ??? ?? ??? ???? ?? ??????. ??? ??? ?? jQuery? ? ?? ?? ???

QQ截圖20161025142026.png

append? ?????. ? ??? ??? ??? ?? ??appendChild ???? ???? ?? ??? ???? ?? ?????.

appendTo: ??? ? ??? ???? ??? $(A).append(B) ??? ?????. ?, B? A? ???? ?? A? B? ?????.

??: ? ?? ???? add()? .appendTo()? ??? ??? ??? ????. ?? ???? ?????. ?, ???? ??? ??? ????.

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

appendTo() ?? ??? ??? ?? ??? ?? ? ??? ??? ??

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

<!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>
    .content {
        width: 300px;
    }
    .append{
        background-color: blue;
    }
    .appendTo{
        background-color: red;
    }
    </style>
</head>

<body>
    <button id="bt1">append添加</button>
    <button id="bt2">appendTo添加</button>

    <div class="content"></div>

    <script type="text/javascript">

        $("#bt1").on('click', function() {
            //.append(), 內(nèi)容在方法的后面,
            //參數(shù)是將要插入的內(nèi)容。
            $(".content").append('<div class="append">php 中文網(wǎng)</div>')
        })
    </script>

    <script type="text/javascript">

        $("#bt2").on('click', function() {
            //.appendTo()剛好相反,內(nèi)容在方法前面,
            //無(wú)論是一個(gè)選擇器表達(dá)式 或創(chuàng)建作為標(biāo)記上的標(biāo)記
            //它都將被插入到目標(biāo)容器的末尾。
            $('<div class="appendTo">php.cn</div>').appendTo($(".content"))
        })

    </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> .content { width: 300px; } .append{ background-color: blue; } .appendTo{ background-color: red; } </style> </head> <body> <button id="bt1">append添加</button> <button id="bt2">appendTo添加</button> <div class="content"></div> <script type="text/javascript"> $("#bt1").on('click', function() { //.append(), 內(nèi)容在方法的后面, //參數(shù)是將要插入的內(nèi)容。 $(".content").append('<div class="append">php 中文網(wǎng)</div>') }) </script> <script type="text/javascript"> $("#bt2").on('click', function() { //.appendTo()剛好相反,內(nèi)容在方法前面, //無(wú)論是一個(gè)選擇器表達(dá)式 或創(chuàng)建作為標(biāo)記上的標(biāo)記 //它都將被插入到目標(biāo)容器的末尾。 $('<div class="appendTo">php.cn</div>').appendTo($(".content")) }) </script> </body> </html>