Pergunta

I have a textbox and i have values in database like ® which is equal to ® .I fetch data and write it into textbox but it writes the data as it is.The code part is like this

var data=database_values;//here there is data like this "DOLBY®"
document.getElementById(id).value = data;

I want to make the textbox value DOLBY® not DOLBY®

Foi útil?

Solução 3

Hi i found a way to unescape html code.Here is the function

function unescapeHTML(html) {
var tempHtmlNode = document.createElement("tempDiv");
tempHtmlNode.innerHTML = html;
if(tempHtmlNode.innerText)
return tempHtmlNode.innerText; // IE
return tempHtmlNode.textContent; // FF

}

Thanks for your help anyway

Outras dicas

If you are getting ® as ® then unescape it.

document.getElementById(id).value = unescape(data);

Assuming you're using a server side language (i.e php) there are functions for that.

for example this will work with php:

html_entity_decode($data);

if you're set on using javascript, there's still a way. see the code here.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top