1

1
2
3
4
5
6
7
8
9
10
11
12
13
$(function() {     
                var all = $(".test");
                $(".test").each(function() {
                    var y = $(this).children();
                    $.each(y,function(key,value){          
                        console.log(value.innerHTML)//获取文本值
                        if(value.getAttribute("data-url").indexOf("1")!=-1){//获取li的属性
                          value.style.display="none"//设置li的样式
                        }
                    })
                     
                });
            })

  2

1
2
3
4
5
6
7
8
9
10
11
12
13
<ul class="test">
            <li data-url='1.1' class="s">1</li>
            <li data-url='2.2'>2</li>
            <li data-url='3.2'>3</li>
            <li data-url='4.2'>4</li>
        </ul>
 
        <ul class="test">
            <li data-url='1'>a</li>
            <li data-url='2'>b</li>
            <li data-url='3'>c</li>
            <li data-url='4'>d</li>
        </ul>