JSFiddle - React, Tailwind, and code Playground
by Sourav Chatterjee
HTML
<h1>Autofill test</h1>
<form class="data-form">
<label>
<input type="hidden" readonly/>
</label>
<label>First Name
<input type="text" readonly/>
</label>
<br>
<label>Middle Name
<input type="text" readonly/>
</label>
<br>
<label>Last Name
<input type="text" readonly/>
</label>
<br>
<label>Phonenumber
<input type="text" readonly/>
</label>
<br>
</form>
<table border = "1" class="data-table" id="test">
<thead>
<tr>
<th>Select</th>
<th>Unique ID</th>
<th>Provider Name</th>
<th>Primary Physician Name</th>
<th>Provider Phone Number</th>
</tr>
</thead>
<tr>
<td><input type="radio" id="one"></td>
<td>1</td>
<td>KAiser </td>
<td>Chatterjee</td>
<td>200000</td>
</tr>
<tr>
<td><input type="radio"></td>
<td>2</td>
<td>XYX</td>
<td>Davis</td>
<td>42282828</td>
</tr>
<tr>
<td><input type="radio"></td>
<td>3</td>
<td>ABC</td>
<td>TIM</td>
<td>63334343</td>
</tr>
</table>
JavaScript
$(document).ready(function () {
$("td", this).on("click", function () {
var tds = $(this).parents("tr").find("td");
$.each(tds, function (i, value) {
$($(".data-form input")[i]).val($(values).text());
});
});
});