wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes how to apply css style to particular words in text area Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "how to apply css style to particular words in text area" Watch "how to apply css style to particular words in text area" New topic
Author

how to apply css style to particular words in text area

Sujatha Kalluri
Ranch Hand

Joined: Oct 09, 2002
Posts: 33
Hi,

I have a jsp page in which textarea element is popoulated with data from request parameter. I want to make some of the words in the text area bold and italics, how do I apply css to selective words inside textarea. or can I make those words bold , italics in java itself before sending to jsp? I googled it but no solution.



thanks in advance,
Sk
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

You would be better off using an existing solution rather than recreating it on your own. You could try something (but not limited to) this. There are tons out there. Just Google for "html rich text editor".


GenRocket - Experts at Building Test Data
Shinelin Samuel
Ranch Hand

Joined: Mar 01, 2010
Posts: 55
Hi,
You can achieve this by including(hard code) the corresponding HTML tags between the text. (guess that you might have tried this)
To my knowledege, you cannot associate a CSS style in this case, as css style need to be attached to a HTML component tag.

Gregg's link will definitely help you.

Thanks,
Shinelin
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Since no one said it yet, It is impossible to style portions of a textarea differently. If you apply a style, it has to apply to everything in that element. You would have to look at at RTE as Gregg mentioned. There are plenty of options out there.

Eric
Sujatha Kalluri
Ranch Hand

Joined: Oct 09, 2002
Posts: 33
Thank you for your suggestions. I will look for RTE option.

Sujatha.
 
Consider Paul's rocket mass heater.
 
subject: how to apply css style to particular words in text area
 
Similar Threads
Locking the JText Area
CSS style not applied to div
NEED help on java script!!!!
CSS and doctype
Select some text from textarea