How to make Safari form validation?

Faced with the nuisance that would not do whatever validation is not used leave blank form from Safari browser! With other browsers everything is OK! Does anyone know an effective way to deal with Safari? Here is an example that should actually work! Thanks in advance for the help!

var form = document.getElementById('formID'); // form has to have ID: 
form.noValidate = true; form.addEventListener('submit', function(event) { // listen for form submitting if (!event.target.checkValidity()) { event.preventDefault(); // dismiss the default functionality alert('Please fill the form'); // error message } }, false);


 Your name: <input required="true">
<br / >
 <input type="submit">
July 8th 19 at 15:54
1 answer
July 8th 19 at 15:56
To input check-in was name.
Check whether event.target Safari returns a reference to the form (or try this).

Find more questions by tags Browsers