水木社区手机版
首页
|版面-Web开发(WebDev)|
新版wap站已上线
返回
1/1
|
转到
主题:[求助]请教一个jquery的问题,谢谢
楼主
|
BrendanEich
|
2015-05-26 20:14:50
|
展开
html
<div id="selector" class="btn-group">
<button type="button" class="btn active" id="Day">Day</button>
<button type="button" class="btn" id="Week">Week</button>
<button type="button" class="btn" id="Month">Month</button>
<button type="button" class="btn" id="Year">Year</button>
</div>
jquery
$(document).ready(function() {
alert("abcde");
$('div.btn').click(function() {
$(this).addClass('active').siblings().removeClass('active');
alert($(this).attr('id'));
alert("abcdef");
});
});
为啥我的代码点击按钮不能生效呢?而且不能弹出"abcdef",
只能弹出"abcde",谢谢
--
FROM 120.204.251.*
2楼
|
BrendanEich
|
2015-05-27 15:32:34
|
展开
谢谢你的渔和鱼:)
【 在 ottffsse 的大作中提到: 】
: //change div.btn to button.btn
: //here is how it works:
http://output.jsbin.com/tihojajowe
:
--
FROM 120.204.251.*
1/1
|
转到
选择讨论区
首页
|
分区
|
热推
BYR-Team
©
2010.
KBS Dev-Team
©
2011
登录完整版