首页 新闻 会员 周边

请问下面的jquery隐藏部分代码怎么没用?

0
悬赏园豆:5 [已解决问题] 解决于 2016-04-05 15:32
 1 <html xmlns="http://www.w3.org/1999/xhtml">
 2 <head>
 3 <script type="text/javascript" src="jquery.js"></script>
 4 <script type="text/javascript">
 5     $(document).ready(function () {
 6         $(".ex.hide").click(function () {
 7             $(this).parents(".ex").hide("slow");
 8         });
 9     });
10 </script>
11 <!--样式定义-->
12 <style type="text/css">
13 div.ex
14 {
15  background-color:#e5eecc;
16  padding:7px;
17  border:solid 1px #c3c3c3;   
18  }
19 </style>
20 
21 </head>
22 <body>
23 <h3>Island Trading</h3>
24 <div class="ex">
25 <button class="hide" type="button">Hide me
26 </button>
27 <p>Contact:Helen Bennett<br />
28 Garden House Crowther Way<br />
29 London
30 </p>
31 </div>
32 
33 <h3>Pairs Trading</h3>
34 <div class="ex">
35 <button class="hide" type="button">Hide me</button>
36 <p>Contact:Marie Bertrand<br />
37 265,Boulevard Charonne<br/>
38 Pairs
39 </p>
40 </div>
41 </body>
42 </html>
wq_vincent的主页 wq_vincent | 初学一级 | 园豆:5
提问于:2016-04-05 14:55
< >
分享
最佳答案
0

$(".ex.hide")這個選擇器沒有任何符合的element

收获园豆:5
RosonJ | 老鸟四级 |园豆:4910 | 2016-04-05 15:15

x下面不是有class="hide"的元素嘛

wq_vincent | 园豆:5 (初学一级) | 2016-04-05 15:24

@wq_vincent: 

$(".ex.hide")這個選擇器是選擇同時有ex和hide兩個class的element

你的頁面不存在符合的element

RosonJ | 园豆:4910 (老鸟四级) | 2016-04-05 15:26

@RosonJ: 3Q VERY MUCH,SIR

wq_vincent | 园豆:5 (初学一级) | 2016-04-05 15:32
其他回答(1)
0

src="jquery.js" 

 

jQuery这里引入架包路径是否找到?如果没有的话需重新引用、或者用纯js写

Ctrl` | 园豆:3317 (老鸟四级) | 2016-04-05 15:10
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册