dom元素通过js修改后页面没有改变

现象是,我通过js改变 id为myModalLabel的值,通过console口打印都是对的。但是页面没有变化。remove也不可以。就是dom无法操作了。

<h4 class="modal-title" id="myModalLabel">直播添加</h4>
//js代码
$("#myModalLabel").html("直播编辑");

原因:dom中id重复,浏览器引擎不知道修改哪个了。页面有人修改,自己折腾了半天才发现。感觉自己太low了,记录一下,供大家参考。

猜你喜欢

转载自blog.csdn.net/id_no_chinese/article/details/80279736
今日推荐