resetForm()不能清除表单消息并隐藏反馈图标等

时间:2019-07-08 18:43:32

标签: formvalidation.io

以下代码有效,但是formReset()不能清除表单消息或图标吗?看最后几行。


<!-- Textarea Resizable -->
<div class="form-group g-mb-20">
    <i style="color:red"  class="fa fa-asterisk"></i><label class="g-mb-10" for="inputGroup2_2">Your availability details</label>
    <textarea id="availability" class="form-control form-control-md rounded-0" rows="5" type="text" name="availability" value="" placeholder="Short concise description what you are available for or do."></textarea>
</div>

<!-- Text Input -->

<!-- End Text Input -->





<!-- Select Date Range -->
<div class="form-group mb-0">
    <label class="g-mb-10">Set your availability calendar by clicking on date for when you are NOT available</label>
    <div class="row">



        <div id='availability_calendar'></div>

        <div class="col-xl-4">

            <div class="input-group g-brd-primary--focus">
                <button  type="submit" name="submit"  class="btn btn-md u-btn-primary g-mr-10 g-mb-15">Post your Availability</button>

            </div>

        </div>

    </div>
</div>
<!-- End Select Date Range -->

</form>
<div id='availability_message'></div>

    document.addEventListener('DOMContentLoaded',function(e){         FormValidation.formValidation(             document.getElementById('post_availabiity'),             {                 字段:{                     可用性: {                         验证人:{                             不是空的: {                                 消息:“您必须添加您的可用性消息”                             },                         }                     },                 },                 插件:{                     触发:新的FormValidation.plugins.Trigger(),                     引导程序:new FormValidation.plugins.Bootstrap(),                     SubmitButton:新的FormValidation.plugins.SubmitButton(),                     图标:new FormValidation.plugins.Icon({                         有效:“ fa fa-check”,                         无效:“ fa fa-clock”,                         验证:“ fa fa-refresh”                     }),                 },             }         )             .on('core.form.valid',function(){                 var data = $(“#post_availabiity”)。serializeArray();                 $ .ajax({                     输入:“ POST”,                     网址:“,                     数据:数据,                 })。then(function(response){                     $('#availability_message')。html(“ \ n” +                         “ \ n” +                         “ \ n” +                         “×\ n” +                         “ \ n” +                         “ \ n” +                         “ \ n” +                         “ \ n” +                         “ \ n” +                         “ \ n” +                         “ \ n” +                         “ 做得好!您的空房状况发布成功\ n” +                         “ \ n” +                         “ \ n” +                         “ \ n” +                         “”);                     $(“#availability_message”)。fadeIn(1000);                     $(“#availability_message”)。fadeOut(4000);                     $(“#post_availabiity”)[0] .reset();                     const fv = FormValidation.formValidation();                     fv.resetForm(true);                 });             });     });

0 个答案:

没有答案