これは、現在のコードである上.next()を使用する方法:いくつかの要素
$("input[name='content_use']").click(function() {
if ($(this).is(":checked")){
$(this).closest('tr').next().show();
$(this).closest('tr').next().next().show();
$(this).closest('tr').next().next().next().show();
} else{
$(this).closest('tr').next().hide();
$(this).closest('tr').next().next().hide();
$(this).closest('tr').next().next().next().hide();
}
});
:|
EDIT:
あなたは連続する行に到達するために繰り返しnext()
使用することを私がしなければならない見ることができるように。どのようにこれを短く書くことができますか?
ソリューション:nextUntil()
えっ?もう一度やり直して...あなたは何を求めようとしていますか –
あなたのマークアップは何ですか? 'nextUntil'が解決策かもしれません。 – pimvdb
ください。それはかなり明白です... –