如何用php删除任何类的空div
如何用php删除任何类的空div。下面是代码。如何用php删除任何类的空div,php,Php,如何用php删除任何类的空div。下面是代码。 使用jquery删除div请尝试以下代码 if($("div").empty()){ $(this).remove(); } 试试这个。。它检查每个元素是否有类。下拉列表并检查它是否为空 jQuery $('.dropdown').each(function(i, obj) { if( $(this).is(':empty') ) { $(this).remove(); } }); 使用jq
使用jquery删除div请尝试以下代码
if($("div").empty()){
$(this).remove();
}
试试这个。。它检查每个元素是否有类。下拉列表并检查它是否为空 jQuery
$('.dropdown').each(function(i, obj) {
if( $(this).is(':empty') ) {
$(this).remove();
}
});
使用
jquery
进行查询
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("div").each(function()
{
if($(this).empty())
$(this).remove()
});
})
</script>
$(文档).ready(函数(){
$(“div”)。每个(函数()
{
if($(this.empty())
$(this.remove())
});
})
您不能用PHP删除
s。您可以使用JavaScript来实现这一点。请解释或发布您尝试的完整代码。。处理html元素是用客户端脚本完成的。我得到这个作为post参数,我需要删除空的div标记,Regexp特别询问了一个php解决方案
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("div").each(function()
{
if($(this).empty())
$(this).remove()
});
})
</script>