Execute the same function for both tbody and tfoot

Execute the same function for both tbody and tfoot

As for now this function only includes tbody:

  1. ).each(function (tbodyNumber, tbody) {
  2.                 $(this).attr("id", tbodyNumber)
  3.                 $(this).children().each(function (rowNumber, row) {
  4.                     $(this).attr("id", tbodyNumber + "-" + rowNumber);
  5.                 })

Is there a way to also target tfoot in the same function?

I need to execute the same function for tfoot as well. So the matched element should be either "tbody" or "tfoot".