I believe that you are talking about your own validation of the HTML5 form and do not verify it by self-tuning, I have never encountered a bootstrap check before. (maybe I'm wrong).
Most new browsers will check <input type='email'/> as an email address and <input type='text' required='required'/> as required when submitting the form.
If, for example, you use e.preventDefault(); in the event of clicking on the submit button, the form will not try to submit, and therefore, the built-in verification will never happen.
If you want to keep validation you need to use e.preventDefault(); in the form submission event, not the button click event.
html ...
<form action='' method='post'> <input type='email' name='email' required='required' placeholder='email'/> <button type='submit'>Submit</button> </form>
jQuery ...
//this will stop the click on the button and will not trigger validation as the submit event will never be triggered $("button").on('click',function(e){ e.preventDefault(); //ajax code here }); //this will stop the submit of the form but allow the native HTML5 validation (which is what i believe you are after) $("form").on('submit',function(e){ e.preventDefault(); //ajax code here });
Anyway, hope this helps. If I misunderstood something, let me know, and I try to help further.
Ed fryed
source share