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>