I want to use a submit button because it checks my form input attributes.
My inputs are all numerical and have attributes of min / max / required all given by jQuery:
<form id="form1">
<table id="table">
<tr>
<td>
<input type="number" /> </td>
<td>
<input type="number" /> </td>
<td>
<input type="number" /> </td>
</tr>
</table>
</form>
<button form="form1">check inputs</button>
And the validation attributes are assigned with jQuery (min: 1, max: 9, required)
$('input').attr({
min: 1,
max: 9,
}).prop('required', true);
I have jQuery set up to extract the numerical values from the inputs and put them into an array, but if I use this button, it attempts to 'submit' the form which I don't want. But if I add event.preventDefault() the submit button no longer checks for the min/max/required values.
Essentially all I want my button to do is to check the validation requirements, and trigger the jQuery click event.
EDIT / CLARIFICATION:
I want 3 things: 1. prevent the form from submitting. No POST 2. Validate / make sure each input has a valid value 3. trigger a jQuery click event ( $('button').on('click', function(){ do something... });