Set value of hidden field in a form using jQuery's “.val()” doesn't work
I've been trying to set the value of a hidden field in a form using jQuery, but without success. Here is a sample code that explains the problem. If I keep the input type to "text", it works without any trouble. But, changing the input type to "hidden", doesn't work ! <html> <head> <script type="text/javascript" src="jquery.js"> </script> <script type="text/javascript"> $(document).ready(function() { $("button").click(function() { $("input:text#texens").val("tinkumaster"); }); }); </script> </head> <body> <p> Name: <input type="hidden" id="texens" name="user" value="texens" /> </p> <button>