[英]Change label text from .resx, issue with especial character
I'm trying to change the text property from a label dynamically. 我正在尝试从标签动态更改text属性。 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º.
我从.resx文件中获得了新值,该新值包含字符Nº,但不能正确显示,而是Nº,它显示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
我尝试了一些在stackoverflow上找到的建议,例如Resource文件变量在js警报框中给出了字符串ASCII代码问题
I also tried to use javascript encode/decode functions, but none of them worked. 我也尝试使用javascript编码/解码功能,但是没有一个起作用。 I'm spending a lot of time trying to fix it.
我花了很多时间来修复它。 Please, any help?
请帮忙吗?
Its a MVC3 application. 它是一个MVC3应用程序。 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º de Pares @ Label.LblPares的值为N°de Pares,它向用户显示的值为N&#186 de Pares
Thanks! 谢谢!
Try chaning text() to html(): 尝试将text()更改为html():
$("label[for='Cabo_Pares']").html(novoLabel);
JSFiddle: http://jsfiddle.net/AWzSc/ JSFiddle: http : //jsfiddle.net/AWzSc/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.