[英]Javascript, How to show two value into same input type text field?
I want to show 10 20 in single input type text, but below option is not working. 我想在单个输入类型的文本中显示10 20,但是下面的选项不起作用。 Can any one help me
谁能帮我
Javascript:- Javascript:-
var a = 10;
var b = 20;
document.getElementById("current").value = a , b;
HTML:- HTML:-
<input type="text" id="current">
试试document.getElementById("current").value= a +" " + b;
According to your question simply use following to concat two values. 根据您的问题,只需使用以下命令来连接两个值。
var a = 10;
var b = 20;
document.getElementById("current").value = a+" "+b;
您可以执行以下操作:
document.getElementById("current").value = a + " " + b;
Try this : 尝试这个 :
var a = 10;
var b = 20;
document.getElementById("current").value = ""+a +" "+b;
Hope it Helps! 希望能帮助到你!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.