user2593318
user2593318

Reputation: 35

convert html tags to string

My ajax call returns a strings where my first string will be code like this

 response[0]=2 

and

 response[1]= Enter the reasons the application is being returned,<br><br><span style="color: red; font-weight: bold;">* Caution! The text of this Message will be included in notices sent to the applicant *</span>

and i am assigning this to the id of my input tag like this

document.getElementById('messageHint').value = response[1] ;

But it doesnt render these <br> and <span> tags in to Html,instead it just shows them in the same format.How do i need to fix this issue.

I tried different apporches like parse.Html() and $html.prop('outerHTML'); but neither one showed me the desired out put.

Upvotes: 0

Views: 194

Answers (2)

Rahul
Rahul

Reputation: 211

 You can give only one style to one placeholder like this:

 <style>

 input::-webkit-input-placeholder { font-size: 16pt; color: #555; }
 input::-moz-placeholder { font-size: 16pt; color: #555; }
 input:-ms-input-placeholder { font-size: 16pt; color: #555; }
 input:-moz-placeholder { font-size: 16pt; color: #555; }  

 input.other::-webkit-input-placeholder { font-size: 12pt; color: red; }
 input.other::-moz-placeholder { font-size: 12pt; color: red; }
 input.other:-ms-input-placeholder { font-size: 12pt; color: red; }
 input.other:-moz-placeholder { font-size: 12pt; color: red; }

 </style>

 <input type="text" placeholder="Hello"></input>
 <input type="text" class="other" placeholder="Hello"></input>

 and yes, .innerhtml is used to put the content into a div, not into an input field. so that's not useful to you in anyway.

Upvotes: 0

Wilfredo P
Wilfredo P

Reputation: 4076

I think you need to use document.getElementById('messageHint').innerHTML instead.

LIVE DEMO

Upvotes: 1

Related Questions