$("#btn").click(function(){ $("#test").append(" <div>XXXXXXXXXXXXX</div>"); //或者 $("<div>XXXXXXXXXXXXX</div>").appendTo("#test"); }); $("#btn").live("click",function(){ $("#test").append(" <div>XXXXXXXXXXXXX</div>"); //或者 $("<div>XXXXXXXXXXXXX</div>").appendTo("#test"); }); $("#btn").bind("click",function(){ $("#test").append(" <div>XXXXXXXXXXXXX</div>"); //或者 $("<div>XXXXXXXXXXXXX</div>").appendTo("#test"); });
如果要刪除:
var obj = $("#test");
obj.remove();