tags:

views:

47

answers:

5

Hello

how to apply text decoration on text in textarea ,like bold ,italic, underlined,ect?

A: 

You would need to use a rich text box plugin via javascript. There are many available for different javascript libraries, and some that are standalone. They are usually called Visual or WYSIWYG editors.

You should be able to find some quite easily with Google.

Jason Miesionczek
+3  A: 

That's not possible with simple textarea, you will have to use rich text editors. Some of the famous are:

Sarfraz
A: 

Hi, you would need to use WYSIWYG plugin - http://plugins.jquery.com/plugin-tags/wysiwyg or relevant JS script.

Elen
+1  A: 

If you want to style the whole object, you can do it like any other element in CSS.

#mytextarea {font-weight:bold;}

etc.

However, I suspect what you're actually asking for is to style parts of the text in the textarea; ie to effectively make a rich text control. This can't be done with a standard textarea field.

The best solution in this case would be to use one of a WYSIWYG editor control written in Javascript. Fortunately there are a number of these available. Try Spaw Editor for example (but there are plenty of others).

Spudley
A: 

Its not possible to apply styles to text within a textarea.

You can instead look into the contentEditable attribute.

<div id="textarea" contentEditable="true"></div>

The contentEditable property works in FF3, Opera and Safari.

Russell Dias