Jquery判断div是否为空,为空就隐藏
最近的一个项目笔记JQ判断div是否为空,javascript根据当前时间来显示广告需要的朋友可以参考一下
1.html
<li class="img1" style="background:red; height:100px"> <ul style="background:red; height:50px; background:#000"> </ul> </li> <li class="img1" style="background:#ccc; height:100px"> <ul> </ul> </li>
2.jquery
$(document).ready(function () { $(".img1 ul").each(function(){ var t = $(this).html(); t = t.replace(/s/g,"").replace(/ /g,""); //换行替换为空 if(t == ''){ $(".img1 ul").parent().css("display","none"); //这个也是隐藏 //$(this).parent().hide(); } }); });
javascript根据当前时间来显示广告
javascript根据当前时间来显示广告【根据时间来判断】
[runcode height=”300″]
javascript根据当前时间来显示广告【根据星期来判断】
[/runcode]
[runcode height=”300″]
广告位1
广告位2
广告位3
[/runcode]