Set value of hidden field in a form using jQuery’s “.val()” doesn’t work

:text will fail for a input with a type value of hidden. It’s also much more efficient to just use:

$("#texens").val("tinkumaster");

ID attributes should be unique on a web page, make sure yours are as this may contribute to any problems you’re having, and specifying a more complicated selector just slows things down and doesn’t look as neat.

Example at http://jsbin.com/elovo/edit, using your example code at http://jsbin.com/elovo/2/edit[

Leave a Comment