简体   繁体   English

HTML5要求的验证无法正常工作

[英]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 我正在使用HTML 5验证字段。我在单击按钮时使用javascript提交了表单

But the validation doesn't work on my pc fire fox,it work only on my pc chrome. 但是验证不适用于我的PC狐狸,它仅适用于我的PC chrome。 also it d'osent work in the integration server with both chrome and fire fox This is the HTML code. 此外,它还无法在集成服务器中同时使用chrome和fire fox。这是HTML代码。

<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). 我的谷歌浏览器版本为56.0.2924.87版(64位)。 My firefox version is 45.6.0. 我的Firefox版本是45.6.0。

Edit this is my JS code: 编辑这是我的JS代码:

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 删除此行后,问题分配器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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