2013-09-24 28 views
0

是否有任何簡單的方法來切換表中的一列的可見性? 我知道我可以使用jQuery並編寫一些代碼來做到這一點,但我認爲有更簡單的方法來做到這一點。如何切換表中的列可見性?

+0

您使用引導依賴於jQuery的,爲什麼你不應該使用jQuery? –

+0

您可以按照http://stackoverflow.com中的建議使用[':nth-​​child'](https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-child)選擇器。/questions/3428480/is-it-it-it-it-it-hide-show-table-by-change-the-css-class -coll –

回答

-1

In Bootstrap 3是一個類.hidden。您可以將此類添加到列中,但不應該可見。

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> 
+1

我想切換列而不是行 – UnknownError1337