使用jquery关闭模式弹出窗口

时间:2017-05-31 05:17:49

标签: jquery asp.net-mvc popup

下面的代码是我的弹出视图...我想关闭弹出窗口点击关闭按钮(X)弹出窗口...在视图的底部我有jquery关闭弹出窗口...但那是不工作..我在另一个弹出窗口弹出。就像父弹出窗口和子弹出窗口一样。在这种情况下我必须关闭子弹出窗口...请帮帮我

<div class="modal-dialog" style="width:1056px" id="pop">
    <div class="modal-content">
       <div class="modal-header">            
            <input type="button" onclick="close()" id="button" value="Close [x]" />          

        </div>
        <div class="modal-body">
            <div class="scroller">
                <table class="display table table-striped table-bordered table-hover" id='tblTicket' cellspacing="0" width="100%">
                    <thead>
                        <tr>
                            <th>Data</th>                            
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>Data</td>                            
                        </tr>

                    </tbody>
                </table>


                <table class="display table table-striped table-bordered table-hover" id='tblTicket' cellspacing="0" width="100%">
                    <tr>
                        <th>DATA</th>                        
                    </tr>

                    @foreach (var item in Model)
                    {
                        <tr>
                            <td>
                             data 
                            </td>                           
                        </tr>
                    }

                </table>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript" language="javascript">
$("#button").click(function () {        
    $("#pop").close
       });
</script>

5 个答案:

答案 0 :(得分:1)

试试这段代码: -

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

    $('#pop').modal('toggle');

});

答案 1 :(得分:0)

试试这个

if (Convert.IsDBNull(tablewsm_View_PurchaseOrderList.TotalValueColumn))
{
    return 0.0;
}

答案 2 :(得分:0)

请检查以下代码:

<script type="text/javascript" language="javascript">

    $("#button").click(function () { 
        $('#pop').modal('toggle');
        $('#pop').modal('hide');
        $('.modal-backdrop').removeClass('modal-backdrop');
        $('.fade').removeClass('fade');
        $('.in').removeClass('in');

        $('html, body').css({
            'overflow': 'auto',
            'height': 'auto'
        });

    });

</script>

干杯!!

答案 3 :(得分:0)

您可以改用类似的方法

<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>

或者如果您真的想使用jquery进行切换,则可以执行此操作(确保它们具有唯一的ID

$("#modal1").modal("toggle")

$("#modal1").modal("hide")

只是隐藏它

答案 4 :(得分:0)

您可以简单地向ridership_diff <- with(public_trans, ifelse(type_of_public_transport[-1] == type_of_public_transport[-nrow(public_trans)] & average_ridership[-nrow(publlic_trans)] == 0, 0, average_ridership[-1] -average_ridership[-nrow(public_trans)])) 添加数据删除模式:

#button
相关问题