Passing javascript variable to html textbox

前端 未结 6 2031
旧巷少年郎
旧巷少年郎 2020-12-14 04:53

i need help on html form.

I got a javascript variable, and I am trying to pass the variable to a html form texbox. I want to display the variable on the textbox dyna

6条回答
  •  萌比男神i
    2020-12-14 05:21

    Pass the variable to the form element like this

    your form element

    
    

    javascript

    var test = "Hello";
    document.getElementById("mytext").value = test;//Now you get the js variable inside your form element
    

提交回复
热议问题