猿问

Jquery Hide 在数据表的第二页中不起作用

我有一个 JQuery 函数,它在单击表上的按钮时隐藏数据表,然后显示一个表单。它适用于第一页,但在其他页面上不起作用,当我使用搜索查询来搜索用户并单击按钮(查询后)时,隐藏 Jquery 命令不起作用


<script type="text/javascript">

    $(document).ready(function () {

        $('#past_years').DataTable({

            select: true

        });

        $('#insert_form').hide();



        $("#add_button").click(function () {

            $('#wrapper').hide();

            $('#insert_form').show();

        });

    });

</script>


海绵宝宝撒
浏览 129回答 1
1回答

FFIVE

试试下面的代码&nbsp;<script type="text/javascript">&nbsp; &nbsp; &nbsp; &nbsp; $(document).ready(function () {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $('#past_years').DataTable({&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; select: true&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; });&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $('#insert_form').hide();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $(document).on("click","#add_button",function () {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $('#wrapper').hide();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $('#insert_form').show();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; });&nbsp; &nbsp; &nbsp; &nbsp; });&nbsp; &nbsp; </script>
随时随地看视频慕课网APP
我要回答