set readonly attribute to keep the input editable
Is it possible to set "readonly" attribute of an input to keep it editable?
I'm doing a crossword and I can change my function to search for/select a tag using different attribute but I'm still wondering if it is possible.
Thanks for help in advance!
If the HTML readonly attribute is present, then the readOnly property will default to true.
If the HTML readonly attribute is not present, then the readOnly property will default to false.
You could also use the disabled attribute, with two differences: the field is displayed grayed out, and you can set the disabled attribute directly.
It's all tested/demonstrated in this jsfiddle [note: updated]
I suggest using the html5 supported data- prefix data-readonly="true" https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Using_data_attributes