How to get hidden field value in jQuery

satinder singh / Updated : / 0 Comments

Get Hidden field value: Here in this tutorial will learn how we can get values of the hidden filed.  As jQuery is a powerful javascript library by using which we can manipulate HTML DOM easily. In jQuery to get hidden field value we use.val() method.

The .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 set hidden field value in jQuery.

jQuery Code: Get hidden field value

var getValue= $("#HiddenFieldID").val();
alert(getValue);

That’s it you just need to change the hiddenFieldId respectively and with .val() method you get the value of your hidden field.  Make sure ID attributes should be unique on a web page.

Here in demo example on button click, we alert hidden field value.

Try It Yourself ⇒

 

Other Reference

You can also check these articles:

  1. Preview Image before upload it with jQuery in Asp.net.
  2. How to get the filename, size, type count in jQuery [input file, File Api].
  3. Create dynamic HTML table using jquery.
  4. How to remove table row tr in jquery on button click.
  5. 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!


Post Comment


Your email address will not be published. Required fields are marked *