I've got a squarespace form I'm working on that uses jQuery to show/hide certain fields to allow a custom form using show(); and hide();
$(".option2 select").hide();
The problem is that this doesn't remove them from the DOM, and so any hidden fields are STILL submitted in the squarespace email.
$(".option2 select").remove();
This is the only function that successfully removes the select from the DOM and stops it from being included in the form submit, but since it's irreversible, it breaks the form.
Is there a way to use remove(); on certain elements just as the submit button is pressed to permanently remove them from the DOM before the form is actually submitted?
Edit: I should clarify that since this is done in Squarespace, it's tricky to use onSubmit since there are already other things going on. I'm looking for a jQuery-only solution that doesn't involve editing any of the HTML of the form in any way.