I'm trying to change the text property from a label dynamically. I get the new value from a .resx file, this new value contains the characters Nº, but it doesn't display correctly, instead Nº it displays N&#186. I tried some advises that I found here on the stackoverflow, like Resource file variable giving string ASCII code issues in js alert box

I also tried to use javascript encode/decode functions, but none of them worked. I'm spending a lot of time trying to fix it. Please, any help?

Its a MVC3 application. My code:

  novoLabel = "@Label.LblPares";

 $("label[for='Cabo_Pares']").text(novoLabel);

@Label.LblPares value is Nº de Pares and its displays to the user the value N&#186 de Pares

Thanks!

有帮助吗?

解决方案

Try chaning text() to html():

$("label[for='Cabo_Pares']").html(novoLabel);

JSFiddle: http://jsfiddle.net/AWzSc/

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top