将禁用的输入从真实变为false时,为什么不单击输入

  • 本文关键字:单击 false 真实 javascript
  • 更新时间 :
  • 英文 :


我的函数将输入属性从真实变为false。DOM和CSS更新,但我仍然无法单击或使用输入。

<input id="playerLocation" type="text" name="location" oninput="setPlayerLocation()" disabled="true">
.player-details input[disabled="true"] {
  opacity: 0.6;
}
playerLocation.setAttribute('disabled', false);

您需要使用removeAttribute进行禁用。

playerLocation.removeAttribute('disabled');
<input id="playerLocation" type="text" name="location" oninput="setPlayerLocation()" disabled="true">

相关内容

最新更新