Or, asked another way, do hidden form elements (<input type="hidden"... />
) support jQuery's click()
method?
Yes, hidden inputs work with the click()
method. You can't click on a hidden input element with your mouse, but you can execute the click event using the click method.
So, given this HTML:
<form>
<input type="hidden" name="input1" id="input1" value="Yes">
</form>
You can assign a click handler:
$('#input1').click(function () {
//do something
});
and invoke the click event:
$('#input1').click();
See http://jsfiddle.net/jhfrench/v6LUd/ for a working example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With