Tuesday, 13 August 2013

How not to validate HTML5 text box with required atrribute

How not to validate HTML5 text box with required atrribute

I have one HTML text box (for quantity) and two HTML buttons (Add, Cancel)
inside my form.
<form>
<input type="number" min="1" max="100" required />
<button type="button">Add</button>
<button type="button">Cancel</button>
</form>
I do not want my second button (cancel) to validate the form when clicked.
Is this possible? In ASP.NET, I can use CausesValidation="false" to not
trigger the validation.

No comments:

Post a Comment