JavaScript Convert html tag in textarea to rich text convert textarea html,textarea convert html to text,html convert

I am using PHP to fill a textarea:

<textarea text-input" id="Desc" rows="15" wrap="soft" name="Desc"><?php echo $Desc; ?></textarea> 

but the textarea is showing HTML tags in it, which I don't want.

<b>Analog And Digital System</b><br />
<b>Analog System:</b><br />
A string tied to a doorknob would be an analog system. They have a value that changes steadily over time and can have any one of an infinite set of values in a range. If you put a measuring stick or ruler at a specific point along the string, you can measure the string's value every so many seconds at that point. When you watch it move, you will see it moves constantly. It doesn't instantly jump up and down the ruler. <br />
<br />
<b>Digital System:</b><br />
A digital system would be to flick the light switch on and off. There's no 'in between' values, unlike our string. If the switch you are using is not a dimmer switch, then the light is either on, or off. In this case, the transmitter is the light bulb, the media is the air, and the receiver is your eye. This would be a digital system.<br />

Basically what I want to do is convert <b> tags to make the content bold and <br> tags to new lines.

I want to do it without using any editor.

Answer:1

There is no way to to do HTML formatting inside textarea you will have to use ant editor, but if you want to show it in div then setting the attribute contentEditable="true" will do the trick

more references here (already asked on stackoverflow)

Answer:2

If you want to show only the HTML output, then use a div tag instead of textarea. Because, we cannot show Rendered HTML inside a textarea.

If you want to show HTML output and want that editable, use contenteditable attribute on div tag.

More about contenteditable and it's support can be found at

https://developer.mozilla.org/en-US/docs/Web/HTML/Content_Editable

Answer:3

You should use javascript based WYSIWYG HTML Editors like tinymce and CKEditor for this purpose.

Otherwise the HTML code will remain as they are (plain text).

But if you use the editors, the user will be able to edit the content and the content will be converted to rich text using javascript (and it's exactly what the editors will do for you magically).

WYSIWYG = What You See Is What You Get

Answer:4

i have a <div> like this. <div id="div" class="a b _c d _e f"></div> how can convert classes of <div> to a javaScript array? var cls = $('#div').attr('class'); cls = $(cls)....

i have a <div> like this. <div id="div" class="a b _c d _e f"></div> how can convert classes of <div> to a javaScript array? var cls = $('#div').attr('class'); cls = $(cls)....

THE SITUATION: I am using angular-redactor as editor for my app. Everything is working fine except just one thing. I need to fire a blur event to ask confirmation to the user in case he want to ...

THE SITUATION: I am using angular-redactor as editor for my app. Everything is working fine except just one thing. I need to fire a blur event to ask confirmation to the user in case he want to ...

In the following: ko.utils.arrayForEach(cards, function (card) { setTimeout(function () { observableData().saveCard(card); }, 1000); }); This is supposed to be ...

In the following: ko.utils.arrayForEach(cards, function (card) { setTimeout(function () { observableData().saveCard(card); }, 1000); }); This is supposed to be ...

  1. settimeout every second
  2. settimeout every 5 seconds
  3. settimeout every minute
  4. settimeout every 5 minutes
  5. settimeout every 1 second
  6. settimeout every hour
  7. settimeout every 10 seconds

I see this code in underscore.js. Here it is, with the alias applied: toString = ObjProto.toString, However, to use toString it is also accessible directly like this, w/ out using above code at all....

I see this code in underscore.js. Here it is, with the alias applied: toString = ObjProto.toString, However, to use toString it is also accessible directly like this, w/ out using above code at all....

  1. what purpose of object bar
  2. what's the purpose of object