zoukankan      html  css  js  c++  java
  • [ jquery 文档处理 prepend(content|fn) ] 此方法用于向每个匹配的元素内部前置内容,这是向所有匹配元素内部的开始处插入内容的最佳方式

    向每个匹配的元素内部前置内容,这是向所有匹配元素内部的开始处插入内容的最佳方式

    实例:

    <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').prepend(function(index,oldHtml){
               return index + ' : ' +oldHtml+','; 
            });
        });
    </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>
            </div>
        </div>
    </body>
    </html>
  • 相关阅读:
    WordPress修改后台登录地址
    android开发之浅谈viewpager
    android开发之viewpager and Fragment
    android开发之 广播机制
    android开发之 SQLite(数据库)
    前端目标——天猫网页
    android 开发之Toast
    centos8 单机安装k8s
    mysql 查看库大小
    idea 常见问题
  • 原文地址:https://www.cnblogs.com/mysearchblog/p/5618127.html
Copyright © 2011-2022 走看看