Is there any simple way to toggle visiblity of one column in a table? I know I can use jQuery and write some code to do this, but I think there's much simplier way to do this.
Asked
Active
Viewed 415 times
0

Anshad Vattapoyil
- 23,145
- 18
- 84
- 132

UnknownError1337
- 1,222
- 1
- 12
- 16
-
You use Bootstrap which depends on jQuery, so why shouldn't you use jQuery? – Bass Jobsen Sep 24 '13 at 18:46
-
You could use the [`:nth-child`](https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-child) selector as suggested in http://stackoverflow.com/questions/3428480/is-it-possible-to-hide-show-table-columns-by-changing-the-css-class-on-the-col – Ross Allen Sep 25 '13 at 00:44
1 Answers
-1
In Bootstrap 3 is a class .hidden
. You can add this class to the column, wich shouldn't be visible.
HTML
<table>
<tr>
<td>Bla1<td>
<td>Bla1<td>
<tr>
<tr class="hidden"> //This column is now hidden
<td>Bla2<td>
<td>Bla2<td>
<tr>
<tr>
<td>Bla3<td>
<td>Bla3<td>
<tr>

Marvin
- 371
- 1
- 7