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

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

参数解释如下: 

content

要追加到目标中的内容

function(index, html)

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

实例:

<html >
<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;width: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 >
        <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>