代码隐藏

挑战题
<body>
    <ul>
        <li>1</li>
        <li>2</li>
        <li>3</li>
        <li>4</li>
        <li title="hide" style="display:none">5</li>
        <li title="hide" style="display:none">6</li>
        <li title="hide" style="display:none">7</li>
        <li>8</li>
    </ul>
    <a href="#">更多</a>
    <script>
        $("a").click(function(){
			if($("a").html()==="更多"){
				$("a").html("简化");
				$("ul li").show();
			}else{
				$("a").html("更多");
				$("li[ title='hide']").hide();
				}
			})
    </script>
</body>

猜你喜欢

转载自blog.csdn.net/qq_43371004/article/details/89146219