Reputation: 350
Is there anyway to show text in input text and not as hmtl. I mean: This is</b> bold"/>
I would like to see in the text input
This is bold
for the output of input text
.
Is there any way to do that? 'Cos I now see this in output: <\b>This is<\b> bold
Upvotes: 1
Views: 4373
Reputation: 10481
Short answer? No. Rich text is not a feature of html text input fields.
If you are looking for a full scale What-You-See-Is-What-You-Get (WYSIWYG) editor, than check out TinyMCE or Aloha. They use several iFrames and other trickery to provide rich text as input.
IMO, you should use plain text and a markup language. Take a look at what StackOverflow implements on this very site for asking/answering questions. Its a <text area>
input that accepts markdown as input and writes an html preview to a separate element on the page.
In the end, the choice depends on your user base. If they are mainly programmers and tech heads, its probably safe to use a markup language and <text area>
input. If they are the typical service consumer, TinyMCE or something similar might be your best bet for usability.
Upvotes: 1
Reputation: 3611
You can't.
In a usual html input (type text or a textarea), you can fill only plain text, the html tags are not rendered.
The only way to do that is to use a wysiwyg editor. Ususally in the form of a JavaScript component to add to your page.
There is a lot of wysiwyg editor on the internet, from the simplest to the most complete.
Upvotes: 1