繁体   English   中英

Twitter Bootstrap:隐藏模式时,重新加载页面不起作用

[英]Twitter Bootstrap: Reload page does not work when modal is hidden

我有一个表,其中最后一个标签“ td”调用了一个模态窗口。 问题在于,仅在第一个模态窗口隐藏时有效,页面重新加载,而其他模态窗口重新加载不起作用。

<a class="icon-remove-sign" id="exclusao" href="#modalExclude{{janela.campanha.id}}" data-toggle="modal" title="Excluir"></a> 
// this generate the following urls:
// http://localhost:8000/display/detail/15/#modalExclude11
// http://localhost:8000/display/detail/15/#modalExclude12
// http://localhost:8000/display/detail/15/#modalExclude13

JQuery代码:

$(function() {
    $('#exclusao').click(function() {
        var modal = $(this).attr('href');
        console.log(modal); // show the href only for the first row --> #modalExclude11
        // show modal
        $(modal).modal({
            show: false,
        });
        // clean message info in modal
        $('div#messageExclude').html('');
        // reload page when modal is hidden
        $(modal).on('hidden', function() {
            window.location.reload(true) // work only for the first row --> #modalExclude11
        });

    });
});

所有模式都可以正确显示,但只会使页面重新加载到表的第一行。 有人知道会是什么吗? 谢谢!

问题出在:

<a class="icon-remove-sign" id="exclusao" href="#modalExclude{{janela.campanha.id}}" data-toggle="modal" title="Excluir"></a>

需要与CLASS一起使用,我忘记了ID在代码中必须是唯一的,但与类一起工作。

class="icon-remove-sign"

谢谢!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM