Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to display bold and non-bold text in a textarea? [duplicate]

I don't want this:

<textarea>The <b>color</b> is black.</textarea>

Instead of the <b> and </b> i want the text "color" to be shown in bold.

Is this possible?

like image 980
Jo Smo Avatar asked Jul 03 '13 19:07

Jo Smo


People also ask

What are the two attributes of textarea tag?

The size of a text area is specified by the cols and rows attributes (or with CSS). The name attribute is needed to reference the form data after the form is submitted (if you omit the name attribute, no data from the text area will be submitted). The id attribute is needed to associate the text area with a label.

Does textarea have type attribute?

The <textarea> element does not have a type attribute. The HTML <textarea> element represents a multi-line plain-text editing control, and is useful when you want to allow users to enter a sizeable amount of free-form text, for example a comment on a review or feedback form.

Can we use value attribute in textarea?

<textarea> does not support the value attribute.


2 Answers

You Can't style the content of a text area separately, you have to use <div>s, or something similar. This may be a duplicate of:

Format text in a <textarea>?

Do you Want Something like this:?

http://jsfiddle.net/mekwall/XNkDx/

$('.editable').each(function(){
    this.contentEditable = true;
});

this allows you to edit the content of a div, and it will still look like a textarea,

Bold Works.

like image 68
Deep Avatar answered Oct 09 '22 23:10

Deep


For these cases, avoid use something pure text area, use wysiwyg html editor.

Here are some ideas for you:

ckeditor

niceditor

like image 44
lucianosousa Avatar answered Oct 10 '22 00:10

lucianosousa