appendTo方法在被选元素的结尾插入指定的内容。
<html> <head> <script type="text/javascript" src="/jquery/jquery.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("button").click(function(){ $("<b> Hello World!</b>").appendTo("p"); }); }); </script> </head> <body> <p>This is a paragraph.</p> <p>This is another paragraph.</p> <button>在每个 p 元素的结尾添加内容</button> </body> </html>
亲自尝试:http://www.w3school.com.cn/tiy/t.asp?f=jquery_manipulation_appendto