zoukankan      html  css  js  c++  java
  • [ jquery 文档处理 insertBefore(content) before(content|fn) ] 此方法用于把所有匹配的元素插入到另一个、指定的元素元素集合的前面,实现外部插入

    在每个匹配的元素之前插入内容,用法类似于after() 和insertAfter():

    实例:

    <html lang='zh-cn'>
    <head>
    <title>Insert you title</title>
    <meta http-equiv='description' content='this is my page'>
    <meta http-equiv='keywords' content='keyword1,keyword2,keyword3'>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <script type='text/javascript' src='./js/jquery-1.12.1.min.js'></script>
    <style type="text/css">
        *{margin:0;padding:0;}
        html{font:400 15px/1.2em 'Courier New';color:#666;750px;margin:25px auto;}
        ul{list-style:none;}
        .hover{color:#FF96EC;}
    </style>
    <script type='text/javascript'>
        $(function(){
    
            $('.active').before($('#append'));
            $('p').insertBefore($('.active'));
        });
    </script>
    </head>
    <body>
        <div id='demo'>
            <div class='noClassDemo'>
                <ul class='list'>
                    <li>Index value :</li>
                    <li>Index value :</li>
                    <li>Index value :</li>
                    <li>Index value :</li>
                    <li>Index value :</li>
                    <li>Index value :</li>
                    <li class='active'>Index value :</li>
                    <li>Index value :</li>
                    <li>Index value :</li>
                </ul>
                <div id='append'></div>
                <p class='p'>haha</p>
            </div>
        </div>
    </body>
    </html>
  • 相关阅读:
    Server 对象
    Response 对象
    bzoj 5252: [2018多省省队联测]林克卡特树
    bzoj 2167: 公交车站
    bzoj 5315: [Jsoi2018]防御网络
    bzoj 5319: [Jsoi2018]军训列队
    bzoj 4161: Shlw loves matrixI
    bzoj 4942: [Noi2017]整数
    bzoj 2648: SJY摆棋子
    kd-tree 小结
  • 原文地址:https://www.cnblogs.com/mysearchblog/p/5618340.html
Copyright © 2011-2022 走看看