I have a simple form with phone inputs and some email inputs, however I cannot get rid of the default browser warning messages that come up when I click the submit button.
My CodePen
I've tried to implement event.preventDefault(); however it doesn't seem to work in my case.
$('#profile-info-form').unbind('submit').bind("submit", function(event) {
event.preventDefault();
console.log('save button clicked');
});
Example of the input fields I create on the fly:
var myphone = "<li><label>Cell Phone:</label></li><li><input type='tel' pattern='[0-9]{10}' class='added_mobilephone' name='mobilephone' value='' autocomplete='off' maxlength='20' /></li>";
How would you handle this problem?
If you want to disable client side validation for a form add a novalidate attribute to the form element. Fx:
<form method="post" action="" id="profile-info-form" novalidate>
// Your script Here
</form>
See http://www.w3.org/TR/html5/forms.html#attr-fs-novalidate
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With