通过背景点击关闭模态并隐藏模态

时间:2021-06-29 19:39:28

I need to add some code for dismissing modal by button and by clicking on body that got black background color. How can I find this black area what is id or class name Picture

我需要添加一些代码来解除按钮的模态,并点击获得黑色背景颜色的主体。我怎样才能找到这个黑色区域的id或类名图片

For button where I have data-dismiss='modal' I made in my js file on click on that button do something... And that is to uncheck all checked radio buttons because if I close they will stay checked. So I added this code on button on click

对于我有data-dismiss ='modal'的按钮,我在我的js文件中单击该按钮做了一些事情......那就是取消选中所有选中的单选按钮,因为如果我关闭它们将保持检查状态。所以我在点击按钮上添加了这个代码

$(".close").click(function(){
    $('input[type=radio]').prop('checked', false);  
});

Now I need to find this black area under modal dialog and to say on click there do same but I looked up in console and I only saw it add something to body tag.

现在我需要在模态对话框下找到这个黑色区域并说点击那里做同样但我在控制台中查找并且我只看到它添加了一些东西到body标签。

1 个解决方案

#1


0  

$('.close').click(function(){
    $(this).closest('#Model').hide()
});

#1


0  

$('.close').click(function(){
    $(this).closest('#Model').hide()
});