繁体   English   中英

使用按钮从其他表单重置表单验证

[英]reset form validation from in an other form with button

我正在从validate.io使用,但是我遇到了问题。 我不重置字段验证form1,它在form2中正常工作。

我尝试了扳机,但没有工作。

我能怎么做? 你有个主意吗?

<form id="form1">
    <input type="reset" click="resetForm2()">
</form>

<form id="form2">
    <input id="text1" type="text" value="value">
    <input id="text2" type="text" value="value">
    <input id="text3" type="text" value="value">
    <input id="text4" type="text" value="value">
    .
    .
    .
    <input id="text16" type="text" value="value">
    <input type="reset" click="resetForm2()">
</form>

formvalidation重置方法

function reserForm2()
{
    $('#form2').data('formValidation').resetForm($('#form2'));
}

form="form2"属性添加到其余按钮。 有关详情,请参阅

 function reserForm2() { $('#form2').data('formValidation').resetForm($('#form2')); } 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <form id="form1"> <input type="reset" click="resetForm2()" form="form2"> </form> <form id="form2"> <input id="text1" type="text" value="value"> <input id="text2" type="text" value="value"> <input id="text3" type="text" value="value"> <input id="text4" type="text" value="value"> <input id="text16" type="text" value="value"> <input type="reset" click="resetForm2()"> </form> 

暂无
暂无

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

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