简体   繁体   中英

HTML5 required validation not working [Duplicated]

I'm using HTML 5 for validating fields.I'm submitting the form using javascript on a button click

But the validation doesn't work on my pc fire fox,it work only on my pc chrome. also it d'osent work in the integration server with both chrome and fire fox This is the HTML code.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div class="group-form col-md-9 col-sm-9 col-xs-12">
<label class="text-hide" for="name"></label>
<input type="text" id="name" placeholder="Nom" name="nom" required />
</div>

My google chrome version is Version 56.0.2924.87 (64-bit). My firefox version is 45.6.0.

Edit this is my JS code:

var args = 'ct_nom=' + nom ;
var $myForm = $('#form-contact'); $.get("adresse of the web service" + args, function (data) {
$myForm.submit();
 }).fail(function () {
$myForm.submit();
});

In the validation of the form i found this line of code who causes the problem

event.preventDefault();

after removing this line the problem disapper

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM