How to select and change value of table cell with jQuery?

后端 未结 6 758
春和景丽
春和景丽 2020-12-29 03:18

How do I change the content of the cell containing the \'c\' letter in the HTML sample using jQuery?



        
      
      
      
6条回答
  •  余生分开走
    2020-12-29 04:09

    Using eq() you can target the third cell in the table:

    $('#table_header td').eq(2).html('new content');
    

    If you wanted to target every third cell in each row, use the nth-child-selector:

    $('#table_header td:nth-child(3)').html('new content');
    

提交回复
热议问题