如何使用 GreaseMonkey/TamperMonkey 更改文本字段的输入属性?

How do I change the input attributes of a text field using GreaseMonkey/TamperMonkey?

如何从此输入字段中删除只读属性?

<input class=" calendar_field" id="zoom_meeting_room[scheduled_on]" name="zoom_meeting_room[scheduled_on]" readonly="readonly" type="text" value="2020-11-07 12:08">

谢谢

这是一个例子:

document.querySelector('#zoom_meeting_room[scheduled_on]').removeAttribute('readonly');

document.getElementById('zoom_meeting_room[scheduled_on]').removeAttribute('readonly');

为了避免错误

const input = document.getElementById('zoom_meeting_room[scheduled_on]');
if (input) { input.removeAttribute('readonly'); }

const input = document.getElementById('zoom_meeting_room[scheduled_on]');
input && input.removeAttribute('readonly');

也可以设置为false

const input = document.getElementById('zoom_meeting_room[scheduled_on]');
if (input) { input.readOnly = false; }

const input = document.getElementById('zoom_meeting_room[scheduled_on]');
if (input) { input.setAttribute('readonly', false); }