FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

disable textarea without changing look

 


alalex
how can i disable people from changing the content of a textarea without cheanging the look of it? because i tried writing diabled in the html tag, but it changed the look....
i guess i could create a javascript function to solve it, but i wanted a more simple way to do it... Sad
Ranfaroth
To control the look, use CSS Rolling Eyes
simplyw00x
Code:
<style type="text/css">
input:disabled{
background-color: white;
}
</style>

<input type="..... etc


Basically you use the :disabled pseudo-selector in CSS to style the disabled input to look the same as the enabled one.
cavey
I do not know how important it is for you to keep your visitors from changing the value of your textarea. But remember that even if you use "disabled", your visitors can still change the content. Always do a input-check/validation on the server-side.
santium
You can also add 'readonly' to the textarea tags. This will make it look like a regular textarea, but make it impossible to edit by standard means.
jabapyth
or you can intercept the keyevent handler, and just return false, making nothing happen Smile
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.