JSFiddle - React, Tailwind, and code Playground

HTML

<table>
<tr>
    <td></td>
    <td><button class="format" col="1">Format Col</button></td>
    <td><button class="format" col="2" >Format Col</button></td>
</tr>
<tbody id="body">
<tr>
    <td><input type="text" col="0" row="0" value="0" size="1"></td>
    <td><input type="text" col="1" row="0" value="cat" /></td>
    <td><input type="text" col="2" row="0" value="description" /></td>
</tr>
<tr>
    <td><input type="text" col="0" row="0" value="1" size="1"></td>
    <td><input type="text" col="1" row="0" value="dog" /></td>
    <td><input type="text" col="2" row="0" value="description" /></td>
</tr>
<tr>
    <td><input type="text" col="0" row="0" value="2" size="1"></td>
    <td><input type="text" col="1" row="0" value="mouse" /></td>
    <td><input type="text" col="2" row="0" value="description" /></td>
</tr>
</tbody>
</table>

JavaScript

$(function() {
     $('td button.format').click(function () {
         var template = "Row %0 is for %1";
         var col = $(this).attr("col");
         
         $("#body tr").each(function() {
             var $row = $(this);
             var t = template.replace(/%(\d+)/g, function($0, $1) {
                 return $row.find("td:eq(" + $1 + ") input").val();
             });
             $row.find("td:eq(" + col + ") input").val(t)
         })
     })
 })