Rendering special characters in placeholder of input text box

你。 提交于 2019-12-13 12:39:58

问题


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}}" />

In the controller:

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

Fiddle - http://jsfiddle.net/Lvc0u55v/8334/


回答1:


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

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

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

$scope.somePlaceholder = '●●';


来源:https://stackoverflow.com/questions/38966750/rendering-special-characters-in-placeholder-of-input-text-box

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!