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 dynamically. but i do not know how to pass the variable to the html form and call the variable?
var test;
<INPUT TYPE="TEXT" NAME="lg" VALUE="" SIZE="25" MAXLENGTH="50" disabled="disabled"><BR><BR>
How do i pass test to html form and change its value?
Thanks
You could also use to localStorage feature of HTML5 to store your test value and then access it at any other point in your website by using the
localStorage.getItem()
method. To see how this works you should look at the w3schools explanation or the explanation from the Opera Developer website. Hope this helps.Pass the variable to the form element like this
your form element
javascript
This was a problem for me, too. One reason for doing this (in my case) was that I needed to convert a client-side event (a javascript variable being modified) to a server-side variable (for that variable to be used in php). Hence populating a form with a javascript variable (eg a sessionStorage key/value) and converting it to a $_POST variable.
instead of
You can use
instead of groupName you can pass string value like "Group1"