send a value from javascript to html form input having a value in javascript, need to send that to <'input type='hidden' id='imgscr'/> when submitting the form the value also should submit.. (set value from javascript to html form input)
A:
Your question is not very clear, but I think the answer is
document.getElementById('imgsrc').value = js_variable;
You might want to put this function in the forms onsubmit handler.
Pepijn
2010-03-01 15:41:45
A:
If you use jQuery, this is as easy as:
<form onsubmit="$('#imgscr').val('some value')">
You can substitute whatever you want for the value.
It is also possible to use the form notation if you set a name on your input field:
<form onsubmit="this.imgsrc.value='some value'">
<input type="hidden" name="imgsrc" id="imgsrc">
</form>
tadman
2010-03-01 15:42:06