Except a modal from closing when click on a link

天涯浪子 提交于 2020-01-06 20:23:15

问题


Following these intructions does what I need but what if I want to except/prevend some of the modals from following this rule?

$(".modal a").click(function(){ $(this).closest(".modal").modal("hide");});

回答1:


Give all the modals that you want to exclude a class, like class="noclose". Then add that to the selector.

$(".modal:not(.noclose) a").click(function(){ 
    $(this).closest(".modal").modal("hide");
});


来源:https://stackoverflow.com/questions/35051350/except-a-modal-from-closing-when-click-on-a-link

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!