how to Accessing javascript varible in HTML

0 votes
60 views
asked Jan 9, 2013 in java script by codeg (2,600 points)
in my project i want to use the javascript variable in html page

any solution whould be appreciate..

1 Answer

0 votes
answered Jan 9, 2013 by sahana (2,250 points)

i don't know it's possiable to pass the variable from js to html

but u can able to assign the js variable value into html text filed like this

 

your form element

<input type="text" id="mytext">

javascript

var test = "Hello";
document.getElementById("mytest").value = test;
...