在输入文本框的占位符中呈现特殊字符 [英] Rendering special characters in placeholder of input text box

查看:244
本文介绍了在输入文本框的占位符中呈现特殊字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要显示(● )作为文本输入的占位符.但是它们不只是在占位符中显示unicode而呈现.请帮帮我

I need to show dots (● ) as the placeholder of the text input. But they are not rendering just showing the unicode in the placeholder. Please help me out

<input type="text" ng-model="inputText" placeholder="{{somePlaceholder}}" />

在控制器中:

$scope.somePlaceholder = '&#9679;&#9679;';

小提琴- http://jsfiddle.net/Lvc0u55v/8334/

推荐答案

那是javaScript,您必须对Unicode字符使用\u转义.

That's javaScript, you have to use \u escapes for Unicode characters.

$scope.somePlaceholder = '\u25cf\u25cf';

或者只是按字面写这些点(假设脚本的编码已由Web服务器正确声明).

Or just write those dots literally (assuming the encoding of your script is declared properly by your web server).

$scope.somePlaceholder = '●●';

这篇关于在输入文本框的占位符中呈现特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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