jquery切换效果怎么各切换各的,就是单个切换单个的,不要点一个按钮就全都隐藏了或显示了<html><head><script type="text/javascript" src="jquery.js"></script><script type="text/javascript">$(document).ready(function(){$(".btn1").click(function(){$("p").toggle();});});</script></head><body><p>This is a paragraph.</p><button class="btn1">Toggle</button><p>This is a paragraph.</p><button class="btn1">Toggle</button><p>This is a paragraph.</p><button class="btn1">Toggle</button><p>This is a paragraph.</p><button class="btn1">Toggle</button><p>This is a paragraph.</p><button class="btn1">Toggle</button></body></html>
1 回答
子衿沉夜
TA贡献1828条经验 获得超3个赞
script type="text/javascript">
$(document).ready(function(){
$(".btn1").click(function(){
$(this).next("p").toggle();
});
});
</script>
- 1 回答
- 0 关注
- 511 浏览
添加回答
举报
0/150
提交
取消