简体   繁体   English

如果div B为空,则隐藏div A

[英]Hide div A if div B is empty

I would like to hide div A when Div B has no content inside, I have tried multiple strings of code but I think I am completely missing the idea, here is what I have currently tried 当Div B里面没有内容时,我想隐藏div A,我已经尝试了多行代码,但是我想我完全没想到了,这是我目前正在尝试的内容

if( $('#b').is(':empty') ) {
$('#a').hide;
}

 if( $('#b').text()=='' ) { $('#a').hide(); } 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <div id ='a'>asdasdasd</div> <div id='b'></div> 

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

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