如何检查 div
的可见性,如果 div
是 display:block;
,则隐藏它,或者如果div
是 display:none;
,不要管它吗?
if(codition){
$(".thanks").fadeIn('slow');
$(".thanks").html(json[0]);
$(".thanks").css('color','red');
}else{
//HERE I want to check if the thanks div is display:block,hide it other wise ignore it
$(".errordiv").css('color','green');
$(".errordiv").fadeIn('slow');
}
最佳答案
可能甚至不值得检查它是否已经可见,只需调用 hide 即可。例如。
$('.thanks').hide();
关于jquery - 隐藏设置为显示 :block with jQuery 的 <div>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8607836/