I have multiple input fields on a form like below:
<div class="ginput_container ginput_container_product_calculation">
<input type="hidden" class="gform_hidden" value="Space Cost:" name="input_97.1">
<input type="hidden" class="gform_hidden" value="$150.00" name="input_97.2">
<input type="hidden" class="ginput_quantity_1_97 gform_hidden" value="1" name="input_97.3">
</div>
I need to prevent all hidden input fields in the form from being submitted. The best solution I found so far is to remove the name attributes of input fields but I've no idea how it can be done using jQuery. Any help would be appreciated!
Use .removeAttr().
$("input[type='hidden']").removeAttr('name');
OR
$(":hidden").removeAttr('name');
OR
$("input:hidden").removeAttr('name');
Edit :- Another way to disallow some inputs to post is to make them disabled as disabled form inputs are not submitted.
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