<div class="codetitle"> <span><a style="CURSOR: pointer" data="73145" class="copybut" id="copybut73145" onclick="doCopy('code73145')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code73145"> <br> <br> <br> <br><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <br><title>jquery</title> <br><script type="text/javascript" src="jquery-1.7.2.js"></script> <br><script type="text/javascript"> <BR>$(function(){ <BR>//append()的用法 <BR>//$("ul").append("<li title='abc'>hello"); <BR>//$("ul").append("<li title='xyz'>world"); <BR>//appendTo()的用法 <BR>$("<li title='xyz'>hello").appendTo($("ul")); <BR>}); <BR></script> <br> <br> <br><p title="hello world">您认为圣思园培训好不好呢?</p> <br><ul> <br><li title="1">好</li> <br><li title="2">很好</li> <br><li title="3">非常好</li> <br><li title="4">特别好</li> <br><li title="5">太好了</li> <br><li title="6">好的无法描述了</li> <br> </ul> <br> <br><br> <br> </div> <br>在已有的节点上操作 <br><div class="codetitle"> <span><a style="CURSOR: pointer" data="64859" class="copybut" id="copybut64859" onclick="doCopy('code64859')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code64859"> <br> <br> <br> <br><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <br><title>jquery4</title> <br><script type="text/javascript" src="jquery-1.7.2.js"></script> <br><script type="text/javascript"> <BR>$(function(){ <BR>var li1 = $("<li title='abc'>hello"); <BR>var li2 = $("<li title='abc'>world"); <BR>var li3 = $("<li title='abc'>hello world"); <BR>$("ul").append(li1); <BR>$("ul").prepend(li2); <BR>$("ul li:eq(4)").after(li3); <br><br>}); <BR></script> <br> <br> <br><p title="hello world">您认为圣思园培训好不好呢?</p> <br><ul> <br><li title="1">好</li> <br><li title="2">很好</li> <br><li title="3">非常好</li> <br><li title="4">特别好</li> <br><li title="5">太好了</li> <br><li title="6">好的无法描述了</li> <br> </ul> <br> <br> <br> </div>