[英]Insert text in to Input Field using javascript
I am trying to insert text in to an input field using this code . 我试图使用此代码在输入字段中插入文本。
This is the code I am using: 这是我正在使用的代码:
<input class="cid" type="text" name="c1" />
<input class="cid" type="text" name="c2" />
<input type="button" value="Insert Text" onclick="insertAtCaret('c1','TEXTTOINSERT1');insertAtCaret('c2','TEXTTOINSERT2');" />
But nothing is happening. 但是什么也没发生。 I don't know JS so I'm not sure if the JS code I referenced before is only for textareas which did work when I tested.
我不了解JS,所以不确定之前引用的JS代码是否仅适用于在测试时有效的textarea。
Thanks! 谢谢!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.