如何重置语义Ui形式?

时间:2019-06-22 10:30:12

标签: jquery semantic-ui

我阅读了语义表单验证文档,据我了解,应该使用按钮重置类和jQuery表单重置方法来重置表单,但是似乎没有任何作用。

我尝试用类捕获表单,但是没有用。 这是我的代码

HTML

<form id="ticker_create_form" action="" class="ui form ticker_create" enctype="multipart/form-data">
                @csrf
                <input type="hidden" value="ticker" name="type">

                <div id="" class="ui segments ntf_view_state">
                    <div class="ui segment">
                        <div class="ui checked checkbox">
                            <input type="checkbox" class="ntf_inside" value="inside" name="view_location[]">
                            <label>Inside (Dashboard)</label>
                        </div>
                    </div>
                    <div class="ui segment">
                        <div class="ui checked checkbox">
                            <input type="checkbox" class="ntf_outside" value="outside"
                                   name="view_location[]">
                            <label>Outside</label>
                        </div>
                    </div>
                </div>

                <!-- Description -->
                <div id="" class="field ntf_description">
                    <label for="">Description</label>
                    <textarea placeholder="Provide description (max of 600 characters)"
                              name="description"></textarea>
                </div>
                        </div>

                <div class="field ntf_btns">
                    <button id="add_ticker_btn" class=" positive large ui button ntf_btn" type="button">ADD TICKER
                        NOTIFICATION
                    </button>
                    <button id="reset_ticker_btn" class="negative large ui reset button ntf_btn" type="button">RESET
                        FORM
                    </button>
                </div>

            </form>

jQuery

    $(document).ready(function(){
     $('.ui.reset.button').on('click', function(){
            $('.ui.form.ticker_create').form('reset');
     });
});

0 个答案:

没有答案