簡體   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