How can I select a specific column in a row using jQuery and JavaScript?

前端 未结 3 1994
悲&欢浪女
悲&欢浪女 2021-01-11 16:03

I am very new to jQuery and JavaScript. I have a small question. Let\'s say i have a HTML table like the following

3条回答
  •  -上瘾入骨i
    2021-01-11 16:16

    something like

    $('#mytable tr:eq(0) td:eq(1)').text('ChangedText');
    

    will select the first row, second column (0 based) of the given element (TABLE). In your case, since you know the row id :

    $('#mytable #element td:eq(1)').text('ChangedText');
    

    or simply

    $('#element td:eq(1)').text('ChangedText');
    

提交回复
热议问题