我的表有一个小问题,用 DIV 编码。如果我点击一行,它会打开每一行,但我只想打开我点击的那一行,逻辑上。这是我的例子:
http://jsfiddle.net/autodidact/QPP5S/11/
问题代码
<div class="table">
<div class="table_headline">
<div class="cell_1">When?</div>
<div class="cell_2">What?</div>
<div class="cell_3">Who?</div>
<div class="cell_4">Where?</div><br>
</div>
<div class="row">
<div class="cell_1">Date</div>
<div class="cell_2">Concert</div>
<div class="cell_3">Artist #1 + Artist #2 + Artist #3</div>
<div class="cell_4">Venue</div><br>
</div>
<div class="info">Infos</div>
<div class="row">
<div class="cell_1">Date</div>
<div class="cell_2">Concert</div>
<div class="cell_3">Artist #1 + Artist #2 + Artist #3</div>
<div class="cell_4">Venue</div><br>
</div>
<div class="info">Infos</div>
<div class="row">
<div class="cell_1">Date</div>
<div class="cell_2">Concert</div>
<div class="cell_3">Artist #1 + Artist #2 + Artist #3</div>
<div class="cell_4">Venue</div><br>
</div>
<div class="info">Infos</div>
</div>
<script>$(document).ready(function() {
$('.row').on('click', function() {
$(this).closest('.table').find('.info').slideToggle();
})
})
</script>
编辑:我正在使用 PHP 来获取所有事件。所以小提琴代码只是一个例子。
编辑#2:添加了问题代码