zoukankan      html  css  js  c++  java
  • [ jquery 文档处理 append(content|fn) ] 此方法用于向每个匹配的元素内部追加内容,这个操作与javascript对指定的元素执行appendChild方法,将它们添加到文档中的情况类似

    此方法用于向每个匹配的元素内部追加内容,这个操作与javascript对指定的元素执行appendChild方法,将它们添加到文档中的情况类似

    参数解释如下: 

    content

    要追加到目标中的内容

    function(index, html)

    返回一个HTML字符串,用于追加到每一个匹配元素的里边。接受两个参数,index参数为对象在这个集合中的索引值,html参数为这个对象原先的html值。

    实例:

    <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(){
             $('li').append(function(index,oldHtml){
                 return ' '+index;
             });
        });
    </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>Index value :</li>
                    <li>Index value :</li>
                    <li>Index value :</li>
                </ul>
                
            </div>
        </div>
    </body>
    </html>
  • 相关阅读:
    常见算法的时间复杂度
    electron 展示pdf
    AudioContext
    js 计算文字宽度
    python 窗口被关闭报错
    qq行情数据。sina行情JOSN,建议用qq,涨跌,财务数据有-市盈
    python AttributeError: 'NoneType' object has no attribute 'prepare'
    策略日志
    使用Python下载A股行情的几种方法
    easytrader
  • 原文地址:https://www.cnblogs.com/mysearchblog/p/5617957.html
Copyright © 2011-2022 走看看