SoFunction
Updated on 2025-04-10

JavaScript operation text box readOnly

I got a question about the readOnly property of the text box this morning.

Specifically: use JavaScript to modify this property.

At the beginning, I couldn't get the value of this attribute in Javascript. There was no way, so I searched online. I didn't look carefully, but I just felt that there was no difference between what I wrote and what they wrote. I didn't believe it, and I couldn't do it well? But I just couldn't do it well:(

Finally, I looked at one of the online books carefully and found that there was a problem. I didn’t have capital letters, and I wrote them all in lowercase letters.

   readonly   <====>  readOnly

After changing to the latter, it will be really good :)

It seems that it is not enough to have experience. The most important thing is that you have to study seriously. Attitude determines whether you can learn something...