Shawn
asked on
read only text area or alternative
I have a site where there are conditions in a text area. I have set the text area to read only but noticed when you press the backspace it then takes you to the previous page.
Is there a way to prevent this (non js if possible) or maybe an alternative to textarea? kinda like the box I'm typing in right now but read only.
Is there a way to prevent this (non js if possible) or maybe an alternative to textarea? kinda like the box I'm typing in right now but read only.
You could just put the content in a div, give it a width and height and then add overflow: visible which will allow it to scroll.
ASKER
sounds good. do you have a quick example. never done that before and I'm not too hot with borders in css.
Something like this would work:
CSS
#textArea {
width:500px; /*Change to suit your needs */
height:250px;/*Change to suit your needs */
clear:both;
border:1px inset #333;
}
HTML:
<div id="textArea">
Your content here
</div>
ASKER
I get the box and text but the text goes out of the box rather then having the side bar appear.
Add overflow:scroll;
ASKER
ok, I have the box looking nice now but I still have the same backspace behavior.
Unfortunately the only way to completely disable the backspace key would be Javascript. It's a default function of the browser itself, as far as I understand it.
ASKER
i suppose I could use js. At least it could change that function. any ideas?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
it all works perfect now. thank you
Glad I could help!