Jquery

SHOW - HIDE (1)
  • 조회수 4,019
  • 작성일 2010-09-28
  •  
<script type="text/javascript">
$(function(){
$(".question").css("cursor","pointer");
$(".answer").hide();
$(".question").each(function(index){
$(this).click(function(){
$(".answer").eq(index).show();
});
$(this).dblclick(function(){
$(".answer").eq(index).hide();
});
});
});
</script>


<table cellpadding="0" cellspacing="1"  id="TableSt01" style="width:500px;">
<tr>
<th colspan="2">Show, Hide</th>
</tr>
<tr class="question">
<td>
질문입니다~~~1
</td>
</tr>
<tr class="answer">
<td style="background:#F0F0F0;">
답변입니다~1
</td>
</tr>
<tr class="question">
<td>
질문입니다~~~2
</td>
</tr>
<tr class="answer">
<td style="background:#F0F0F0;">
답변입니다~2
</td>
</tr>
</table>


출처http://hanjiq.egloos.com/2358197