jQuery-文檔處理

來源:互聯網
上載者:User

標籤:end   rtb   button   set   put   log   char   返回   cti   

<!DOCTYPE html><html><head><meta charset="utf-8"><title>jq</title>    <script src="https://cdn.static.runoob.com/libs/jquery/1.10.2/jquery.min.js"></script><style>.x{color:red;}.xx{color:pink;}</style></head><body><script>$(document).ready(function(){    $("#but1").click(function(){        $("p").prepend("<d>前面</d>");    });//將d元素弄到p中的後面    $("#but2").click(function(){        $("p").append("<f>後面</f>")    });//將f元素弄到p中的後面    $("#but3").click(function(){        $("d").prependTo("div");    });//將d元素弄到div中的前面    $("#but4").click(function(){        $("f").appendTo("div");    });//將q元素弄到div中的後面        $("#but5").click(function(){        $("p").before("<z>前面</z>");    });//將s元素弄到p的前面        $("#but6").click(function(){        $("p").after("<x>後面</x>");    });//將s元素弄到p的後面    $("#but7").click(function(){        $("z").insertBefore("div");    });//設定所有 p 元素的內容    $("#but8").click(function(){        $("x").insertAfter("div");    });//返回p元素的常值內容。    });</script>        <input id="but1" type="button" value="裡面的前面">        <input id="but2" type="button" value="裡面的後面">        <input id="but3" type="button" value="更改前位置">        <input id="but4" type="button" value="更改後位置">                <input id="but5" type="button" value="外面的前面">        <input id="but6" type="button" value="外面的後面">            <input id="but7" type="button" value="更改外前位置">        <input id="but8" type="button" value="更改外後位置">        <br />        <div>xxx</div>        <br />        <p>yyy</p>                </body></html>

 

jQuery-文檔處理

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.