은이 같은 몇 가지 일을해야 할 수 있음 : http://jsfiddle.net/VjJpe/ 당신은 마크 업을 따라야합니다. 하나의 테이블 구조 만 제공했지만 동일한 마크 업은 다중 테이블로도 작업을 수행합니다.
<table border="1" class="toggling_table">
<th class="catcher" data-togglerid="1">Click to toggle</th>
<th>No Click</th>
<th class="catcher" data-togglerid="3">Click to toggle</th>
<tr>
<td class="toggler_1" >it will toggle</td>
<td >it will not toggle</td>
<td class="toggler_3">it will toggle</td>
</tr>
<tr>
<td class="toggler_1" >it will toggle</td>
<td >it will not toggle</td>
<td class="toggler_3">it will toggle</td>
</tr>
<tr>
<td class="toggler_1" >it will toggle</td>
<td >it will not toggle</td>
<td class="toggler_3">it will toggle</td>
</tr>
</table>
<script type="text/javascript">
$(function(){
$(".toggling_table").on("click", ".catcher", function(){
var id = $(this).data("togglerid");
alert(id);
$(".toggler_"+id).toggle();
});
});
</script>
1. $ ('# mytable td : nth-child (3)'). toggle()'2. 테이블 열 번호를 알고있는 이유는 무엇입니까? – slash197
그게 핵심입니다. 나는 더 이상 그것을 모른다. 여러 열을 숨기려고합니다. – Chapo
포인트 번호 1에 대한 답변 주셔서 감사합니다. 그것은 효과가있다. – Chapo