Jump to content

TextArea's text color


SunTzu

Recommended Posts

Hi everyone,I need your assistance in the following plssssI have a TextArea with a defaule text ( coming from the 'value' attribute) and i want the subsequent text that i will enter to have different color than the default one.Is that possible? and if yes how can i implement such a thing ...thnx in advance

Link to comment
Share on other sites

Hi everyone,I need your assistance in the following plssssI have a TextArea with a defaule text ( coming from the 'value' attribute) and i want the subsequent text that i will enter to have different color than the default one.Is that possible? and if yes how can i implement such a thing ...thnx in advance
Textarea does not have an attribute "value" :) input does...examples of both textarea and input
<textarea onclick="this.innerHTML='';this.style.color='red'">Default Text</textarea>

<input value="Default Text" onclick="this.value='';this.style.color='red'" />

Is that what you wanted?

Link to comment
Share on other sites

Textarea does not have an attribute "value" :) input does...examples of both textarea and input
<textarea onclick="this.innerHTML='';this.style.color='red'">Default Text</textarea>

<input value="Default Text" onclick="this.value='';this.style.color='red'" />

Is that what you wanted?

It is not exactly what i am looking for ... You are right about 'value' :) Actually i include some text from another form there (this is my default text) and then i want to add some additional text in the area. So, i need this to be with different color.Thak you anyway :)
Link to comment
Share on other sites

It is not exactly what i am looking for ... You are right about 'value' :) Actually i include some text from another form there (this is my default text) and then i want to add some additional text in the area. So, i need this to be with different color.Thak you anyway :)
So you want a textarea to contain text with more than one colour at a time?I don't think you can, you are limited to only one colour AFAIK :)
Link to comment
Share on other sites

Javascript cannot do that, Javascript just interacts with the DOM or with the element's value or inner or outer HTML, and there's no way with any of those to make text inside of an input element or textarea more then one style. The style property for the element applies to the entire element, not to just selected parts of the value or HTML.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...