innerHtml追加元素时input值被清空 场景:动态追加元素时,已填写的input内容被清空 document.getElementById('tbodyGoods').innerHTML += html; 解决方法 <input type="text" onchange="onChangeVal(this);" value="" name="" /> function onChangeVal(e) { e.setAttribute("value", e.value); }