ReadOnly Input Fields in Javascript
To do a read only input fields I normally do a:
However some older web browsers do not support this entirely. In my case I was losing the attibute tags across post back in asp.net. Anyway, I came across a different way of doing this using Javascript. I have no idea why I hadn’t thought of this earlier, it kinda makes me feel dumb
I know that some people will frown on this because Javascript must be turned on. But in my case, Javascript is required to be turned on to run the application because of the AJAX stuff I am doing.
NOTE:Someone at work pointed out another way that you can do this that I never used before, by using the “disabled” attribute.
I think this is a case where you do something one way for so long (like I did the readyonly attribute) and you can miss out on other ways that have their individual advantages.
Written by Tim on March 3rd, 2006 with 2 comments.
Read more articles on web 2.0 ish.