0
我有重複的元素顯示下一類元素
<input style="display:inline" class="chkClass" type="checkbox" value="1"/>
<div class="other">
//something
</div>
<input style="display:inline" class="chkClass" type="checkbox" value="1"/>
<div class="other">
//something
</div>
....
隨着我只想顯示下一個「其他」類複選框的變化。它不`噸的工作:
$('.other').hide(); //hide all "other" elements
$('.chkClass').live('change', function(){
if($(this).is(':checked')){
$(this).next('.other').show();
}
});
另一個$(」。其他')。hide()應該在功能 – 2012-07-14 19:19:45
裏面,你想隱藏並顯示在支票上,或者只是顯示,如果不勾選,就不打擾隱藏?因爲你的代碼應該工作得很好,如果你不想隱藏,如果沒有選中,除非你得到任何js錯誤。 – Kishore 2012-07-14 19:23:11
定義「不起作用」。它的作品[這裏](http://jsfiddle.net/fUHXz/) – Engineer 2012-07-14 19:24:50