Hidden field value set with jQuery doesn't submit
Posted
by
Will
on Stack Overflow
See other posts from Stack Overflow
or by Will
Published on 2011-01-06T00:47:37Z
Indexed on
2011/01/06
0:53 UTC
Read the original article
Hit count: 122
jQuery
I'm completely perplexed. I set the value of a hidden field with jQuery and the submit the form. The hidden value is present when I dump the $_POST array via PHP unless I use Internet Explorer.
Here's the test code:
$('#hidden-field').val('I am a hidden value');
// To make sure it's setting properly ...
// This shows its being set in FF, Chrome, **AND** IE
alert($('#hidden-field').val());
Then on the PHP side:
print_r($_POST);
For submissions made with IE the result looks like this:
Array
(
[hidden-field] =>
)
Other browsers have the value. Help? Why doesn't the value submit and how can I make it?
© Stack Overflow or respective owner