I have this input:
<input id="tag1" type="text" name="tags" class="tags" value="@Model.list" />
and I want to get this input value in a hidden input, so I used this:
<input type="hidden" name="tag" value="tags" />
Instead of getting the true value of the first input, I only get the string "tags"! Can you please tell me how to obtain the true value of the first input in my hidden input?
Thanks!
shreesh chandra shukla
17-Aug-2013I don't understand why you would want to copy the value of one input field to another (albeit, hidden). But if that is what you want to do, try using the below code.
The function attached to the onblur event of the input field would set the value of the input field to the hidden field whenever it loses focus.
The window.onload=setValue; will do the same on page load.
HTML
JS
Best of luck!