Making a form element readonly in firefox

Often we write<input name="foo" value="boo" type="text"> to make an input element readonly not realizing that this is incorrect because IE is ok with it.

The only valid value for the readonly attribute is "readonly". IE by the mere presence of the attribute makes it readonly but not firefox.
So to make the form element readonly in firefox we need to write it as <input name="foo" value="boo" readonly="readonly" type="text">
To verify I have created a 2 form fields you can test it in IE and firefox.

readonly attribute without any value


readonly attribute with readonly as value

Comments

Popular Posts