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

后端 未结 6 739
春和景丽
春和景丽 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 03:52

    $("td:contains('c')").html("new");
    

    or, more precisely $("#table_headers td:contains('c')").html("new");

    and maybe for reuse you could create a function to call

    function ReplaceCellContent(find, replace)
    {
        $("#table_headers td:contains('" + find + "')").html(replace);
    }
    

提交回复
热议问题