append是追加,html是完全替换
比如<p id="1"><p>123</p></p>
$("#1").html("<span>456</span>");
结果是:<p id="1"><span>456</span></p>
$("#1").append("<span></span>");
结果是:<p id="1"><p>123</p><span>456</span></p>
时间: 2024-10-13 03:58:42
append是追加,html是完全替换
比如<p id="1"><p>123</p></p>
$("#1").html("<span>456</span>");
结果是:<p id="1"><span>456</span></p>
$("#1").append("<span></span>");
结果是:<p id="1"><p>123</p><span>456</span></p>