討論 » 建立請求

Re-enable an element

§
發表於:2017-06-14

Re-enable an element

I'd like to prevent a text box in Skype Web from being disabled. It gets a disabled attribute and deleting it in dom inspector re-enables it. So I think that if a script could remove that attribute it won't disable. I wrote this:
document.getElementById('chatInputAreaWithQuotes').removeAttribute('disabled');
Unfortunately it doesn't work. Could someone help me with it?

woxxom管理員
§
發表於:2017-06-14

The simplest approach is to check periodically:

setInterval(() => {
  const el = document.getElementById('chatInputAreaWithQuotes');
  if (el && el.disabled) {
    el.disabled = false;
  }
}, 100);
§
發表於:2017-06-14

Actually I tried it again it worked, thanks. I'd like the same thing with a button found by class: .swx-expression-picker-btn.

woxxom管理員
§
發表於:2017-06-15

Use const el = document.getElementsByClassName('swx-expression-picker-btn')[0]

§
發表於:2017-06-15

It works, thanks.

發表回覆

登入以回覆

长期地址
遇到问题?请前往 GitHub 提 Issues。