.val() method is used to get the values of form elements such as input, select, textarea. You can also check our previous article how to get value of the hidden field in jQuery.
jQuery Code: Set hidden field value
That’s it you just need to change the hiddenFieldId respectively and with .val() method we assign the value to the hidden field. Here in demo example on button click, we assign value what we entered in our textbox. i.e we set our textbox value to the hidden field.Try It Yourself ⇒
You can also check these articles:
- Preview Image before upload it with jQuery in Asp.net.
- How to get the filename, size, type count in jQuery [input file, File Api].
- Create dynamic HTML table using jquery.
- How to remove table row tr in jquery on button click.
- Jquery: How to disable Button, Div, Anchor tag.
Hope you enjoyed this tutorial. If you have any recommendations, please let us know what you think in the comment section below! See you again next time!