$('#dialog_box').on('click', function() { $(this).hide(); }); $('#message_box').on('click', function(e) { e.stopPropagation(); }); 原理是:阻止弹框的点击事件冒泡,遮罩层点击关闭。 转载于:https://blog.51cto.com/happyyoung/1754948