A disabled
element is, (self-explaining) disabled and thereby logically not editable, so:
set the disabled attribute [...] changes the editable attribute too
Is an intended and well-defined behaviour.
The real problem here seems to be you're trying to set disabled
to false
via setAttribute()
which doesn't do what you're expecting. an element is disabled if the disabled
-attribute is set, independent of it's value (so, disabled="true"
, disabled="disabled"
and disabled="false"
all do the same: the element gets disabled). you should instead remove the complete attribute:
element.removeAttribute("disabled");
or set that property directly:
element.disabled = false;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…