Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

get value of hidden field

I reference the hidden field like:

var h = document.getElementById('myHiddenField');

How can I set the value to 100, and then output the value using a simple alert();?

like image 891
Blankman Avatar asked Apr 21 '09 15:04

Blankman


People also ask

How do I access the input type hidden?

The <input type="hidden"> defines a hidden input field.

How get Boolean from hidden field in jQuery?

How do you toggle a hidden field's true/false value using jquery? $('#myDiv'). on('click'), (function() { var hiddenField = $('#myHiddenField'), val = hiddenField. val(); hiddenField.

How do you assign a value to a hidden field?

In jQuery to set a hidden field value, we use . val() method. The jQuery . val() method is used to get or set the values of form elements such as input, select, textarea.


1 Answers

var h = document.getElementById('myHiddenField');
h.value = 100;
alert(h.value);
like image 132
Dan Lew Avatar answered Sep 28 '22 08:09

Dan Lew