JSFiddle - React, Tailwind, and code Playground

by Barry Margolin

HTML

<table id="t">
    <tr>
        <td>
            <input type="text" name="hrtypeCode" value="row 1 col 1" />
        </td>
        <td>
            <input type="text" name="hrCode" value="row 1 col 2" />
        </td>
        <td>
            <input type="text" name="hrName" value="row 1 col 3" />
        </td>
    </tr>
    <tr>
        <td>
            <input type="text" name="hrtypeCode" value="row 2 col 1" />
        </td>
        <td>
            <input type="text" name="hrCode" value="row 2 col 2" />
        </td>
        <td>
            <input type="text" name="hrName" value="row 2 col 3" />
        </td>
    </tr>
</table>
Row:
<select id="row">
    <option value="0">1</option>
    <option value="1">2</option>
</select>
Column:
<select id="col">
    <option value="0">1</option>
    <option value="1">2</option>
    <option value="2">3</option>
</select>
<button id="show" onclick="showit()">Show</button>
<div id="output"></div>

JavaScript

function showit() {
    var tbl = document.getElementById("t");
    var i = document.getElementById("row").value;
    var j = document.getElementById("col").value;
    document.getElementById("output").innerHTML = tbl.rows[i].cells[j].getElementsByTagName("input")[0].value;
}