当我点击任何问题时,所有问题的答案都需要当我点击问题1时显示answer1和question2显示问题2等....
<script src="http://code.jquery.com/jquery-2.1.3.min.js">
</script>
<style>
.prod{cursor: pointer;font-weight: bold;color:#06C;text-decoration: underline; margin:5px; clear:both;}
.scor{display:none; padding-left:5px; color:#666; clear:both;}
</style>
<div class="prod" >
Question1
</div>
<div class="scor" >
Answers1
</div>
<div class="prod" >
Question2
</div>
<div class="scor" >
Answers2
</div>
<div class="prod" >
Question3
</div>
<div class="scor" >
Answers3
</div>
<script>
$(document).ready(function(){
$(".prod").click(function(){
$(".scor").toggle("slow");
});
});
</script>
答案 0 :(得分:0)
如果HTML原样,这将解决您的问题:
Jsfiddle http://jsfiddle.net/ux9ump4d/
脚本:
$(".prod").click(function(e){
$('.scor').hide('slow');
$(e.currentTarget).next().toggle('slow');
});