使用jQuery / JavaScript警示特殊字符 [英] Alerting Special Characters using jQuery/JavaScript

查看:85
本文介绍了使用jQuery / JavaScript警示特殊字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何显示带有€这样的特殊字符的字符串

How do i display a string with Special Characters like € in a Javascript/jQuery alert?

例如:我想显示一个带有价格为€10的消息框

eg: I want to display a message box with "The Price is €10"

但是当我使用以下代码时:

But when i use the below code:

alert("The Price is €10");

消息框中显示的输出为价格为& euro ; 10 ,我希望输出为价格为€10

The Output shown in the message box is "The Price is €10", I want my output to be "The Price is €10".

请帮忙一下吗?

推荐答案

使用此作为警报。

alert(' The Price is \u20AC 10');

描述在这里: http://leftlogic.com/projects/entity-lookup/

这篇关于使用jQuery / JavaScript警示特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆