2012-10-30 45 views
0

fiddle沒有得到更新面板之後跨度ID刷新

我的表,是在更新面板之後更新面板刷新
我不是越來越跨度ID。

$(".csstablelisttd").live('mousedown', function (e) 
       { 
        clearFields(); 

        //This line gets the index of the first clicked row. 
        lastRow = $(this).closest("tr")[0].rowIndex; 

        var rowIndex = $(this).closest("tr").index(); 
        colIndex = $(e.target).closest('td').index(); 
    var id =$('.csstextheader').find('td').eq(colIndex).find('span').attr('id'); 

}); 
<table id="contentPlaceHolderMain_tableAppointment" cellspacing="1" width="100%" bgcolor="#cccccc"> 
     <tr Class="csstextheader"> 
      <td class="csstextheader" width="70px"> 
             </td> 
      <td class="csstextheader" width="70px"> 
              <b>Time Slot&nbsp;</b> 
             </td> 
      <td ID="9"><span id=9>CR (CR1)</span></td> 
      <td ID="10"><span id=10>ES (ES1)</span></td> 
      <td ID="11"><span id=11>MR (MR1)</span></td> 
      <td ID="13"><span id=13>US (US1)</span></td> 
     </tr> 
</table> 
+0

ID在一個頁面中必須是唯一的 – charlietfl

+0

是..................... – lax

+0

如何獲得活的ID – lax

回答

1

您的選擇器不夠精確。使用

$('tr.csstextheader').find('td').eq(colIndex).find('span').attr('id') 

請注意,您也可以使用的

<td class="csstextheader"... 

<th... 

來代替,而你的代碼會一直

$('th').eq(colIndex).find('span').attr('id') 
+0

更新我的表在quetion – lax

+0

哪些代碼我用於獲取ID即時通訊困惑 – lax

+0

如何獲得現場ID – lax