I’m having troubles with textareas readonly attribute. I’m using JQuery to set the attribute, like this :
$("#mytextarea").prop("readonly", true);
The CSS :
textarea { width: 400px; height: 400px; }
textarea[readonly] { overflow: auto; }
The HTML :
<textarea id="mytextarea">Lorem ipsum [...] ament.</textarea>
In Internet Explorer 9, the scrollbars are not showned so users can’t read the overflow content. The behavior with all others majors browsers is correct : the field is not editable but users can freely scroll inside it.
How to fix this?
From http://www.w3schools.com/cssref/pr_pos_overflow.asp
Try out “scroll” as the value of overflow property like this :
Change :
overflow: auto;tooverflow: scroll;Since it does what you not want only in IE9 and if you want to keep auto for other broswer. Create two CSS files and use this code inside your HTML :
and put
overflow: scroll;inside the ie9.css andoverflow: auto;inside your regular CSS.EDIT: Scott suggested, I do too, try to read this link http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ … about how to incorporate multiple css for each browser. It’s a good idea and a good way to reduce HTTP request.