I am new to script. I need to display the value in textbox i have created the textbox inside the tag of my html file. The processed value is in "var a" variable. How can i set the value in textbox
I am new to script. I need to display the value in textbox i have created the textbox inside the tag of my html file. The processed value is in "var a" variable. How can i set the value in textbox
Share Improve this question edited Sep 14, 2011 at 12:30 JB Nizet 693k93 gold badges1.3k silver badges1.3k bronze badges asked Sep 14, 2011 at 12:25 arnparnp 3,2088 gold badges28 silver badges44 bronze badges 1- Some code would help. And Java != JavaScript. – JB Nizet Commented Sep 14, 2011 at 12:30
1 Answer
Reset to default 2With JavaScript something like
var a = 'bla bla bla';
var textBox = document.getElementById("TextBoxID");
textBox.value = a;
Maybe you want to wrap it in some function (pass the text instead)
function addText(text) {
code above;
}
Dont forget to bind it with some kind of event (example onClick
)