Have a table column I'm trying to expand and hide: 有一個表格列我正在嘗試展開和隱藏: jquery
jQuery seems to hide the td
elements when I select it by class but not by element's name . 當我按類而不是按元素名稱選擇時,jQuery彷佛隱藏了td
元素。 ide
For example, why does: 例如,爲何: this
$(".bold").hide(); // selecting by class works $("tcol1").hide(); // select by element name does not work
Note the HTML below, the second column has the same name for all rows. 請注意下面的HTML,第二列對全部行都具備相同的名稱。 How could I create this collection using the name
attribute? 如何使用name
屬性建立此集合? spa
<tr> <td>data1</td> <td name="tcol1" class="bold"> data2</td> </tr> <tr> <td>data1</td> <td name="tcol1" class="bold"> data2</td> </tr> <tr> <td>data1</td> <td name="tcol1" class="bold"> data2</td> </tr>