3 回答
TA贡献1827条经验 获得超4个赞
相同的代码,Juste 将.innerText[i]更改为[i].innerText.trim() ,如下所示:
var x = document.getElementsByClassName('converter');
for (var i = 0; i < x.length; i++) {
if (document.getElementsByClassName('converter')[i].innerHTML.trim() == "Completed") { // Line A
document.getElementsByClassName('converter')[i].disabled = true;
}
}
<td style="width:5%; text-align:center;"><button style="text-align:center; width:120px;" data-id="0" class="converter btn btn-outline-primary"> Completed </button></td>
<td style="width:5%; text-align:center;"><button style="text-align:center; width:120px;" data-id="1" class="converter btn btn-outline-primary"> Completed </button></td>
添加回答
举报