简体   繁体   English

如何使用javascript在输入文本中插入符号

[英]How to insert symbols in input text using javascript

I need some help in inserting html symbols like checkmark character using javascript. 我需要一些帮助,使用javascript插入复选标记字符等html符号。 Here is my code. 这是我的代码。

<script>
function me(){
var a = document.getElementById("me").value = 3;
if(a==3){
document.getElementById("u").value = "checkmark symbol here";
}
</script>
<input type="text" id="me" value=""/>
<input type="text" id="u" value="It will display here a checkmark symbol any symbo"/>
<input type="button" value="click" onclick="me()" />

Any help will be appreciated. 任何帮助将不胜感激。 Thanks! 谢谢!

The JS string "\✓" should produce a checkmark (✓). JS字符串"\✓"应该生成一个复选标记(✓)。 In general, you can find the character you want on this site then copy the "C/C++/Java source code" section: Unicode Character 'CHECK MARK' (U+2713) . 通常,您可以在此站点上找到所需的字符,然后复制“C / C ++ / Java源代码”部分: Unicode字符'CHECK MARK'(U + 2713)

试着改变这个

if (parseInt(document.getElementById("me").value)==3)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM