jquey移除标签内容里面为空的标签

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=GBK" />

<title>网维点餐系统</title>



<script src="jquery-1.7.2.js" type="text/javascript"></script>

<script type="text/javascript">

//jquey移除ul里面为空的标签

$(function(){

    var uls = $(".tree ul");

    //alert(uls.size());

    if(uls.size()>0){

        $.each(uls,function(i){

            if(!$(this).text().trim()){

                $(this).remove();

            }

        });

    }

});

</script>

<body>

<div class="accordionContent">

    <ul class="tree treeFolder">

        <li>

            <!-- 二级菜单 -->

            <a href="order_queryAllOrder" target="navTab" rel="orderManage">订单</a>

            <ul>

            </ul>

        </li>



        <li>

            <!-- 二级菜单 -->

            <a href="OrdManage/orderAdd.jsp" target="navTab" rel="orderAdd">新增订单</a>

            <ul>

            </ul>

        </li>

        

        <li>

            <!-- 二级菜单 -->

            <a href="" target="" rel="deskManage">桌台信息管理</a>

            <ul>

                <li>

                    <!-- 三级菜单 -->

                    <a href="/DianCan/desk_queryAll.action" target="navTab" rel="deskManage">桌台信息管理</a>

                </li>

            </ul>

        </li>



    </ul>

</div>



</body>

</html>

 

你可能感兴趣的:(标签)