<!DOCTYPE html><html>? ? <head>? ? ? ? <title>:visible過濾選擇器</title>? ? ? ? <script src="http://libs.baidu.com/jquery/1.9.0/jquery.js" type="text/javascript"></script>? ? ? ? <link href="style.css" rel="stylesheet" type="text/css" />? ? </head>? ??? ? <body>? ? ? ? <h3>修改可見“水果”的背景色</h3>? ? ? ? <div></div>? ? ? ? <ul>? ? ? ? ? ? <li style="display:none">橘子</li>? ? ? ? ? ? <li style="display:block">香蕉</li>? ? ? ? ? ? <li style="display:">葡萄</li>? ? ? ? ? ? <li>蘋果</li>? ? ? ? ? ? <li style="display:none">西瓜</li>? ? ? ? </ul>? ? ? ??? ? ? ? <script type="text/javascript">? ? ? ? ? ? $("li:visible").css("background-color","blue");? ? ? ? $("li:first").html($("li:hidden").html());? ? ? ? </script>? ? </body></html>
最下面的jQuery語句為什么沒效果,按我理解應(yīng)該把 橘子 顯示出來的?。?/h1>
- 6 回答
- 1 關(guān)注
- 2068 瀏覽
添加回答
舉報
0/150
提交
取消