Reputation: 321
I want to show 10 20 in single input type text, but below option is not working. Can any one help me
Javascript:-
var a = 10;
var b = 20;
document.getElementById("current").value = a , b;
HTML:-
<input type="text" id="current">
Upvotes: 0
Views: 207
Reputation: 1388
Try this :
var a = 10;
var b = 20;
document.getElementById("current").value = ""+a +" "+b;
Hope it Helps!
Upvotes: 0
Reputation: 1583
According to your question simply use following to concat two values.
var a = 10;
var b = 20;
document.getElementById("current").value = a+" "+b;
Upvotes: 1
Reputation: 297
You can do something like this:
document.getElementById("current").value = a + " " + b;
Upvotes: 0