문제

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