JSFiddle - React, Tailwind, and code Playground

by bkuethen

HTML

<table id="id1">
    <tbody>
        <tr>
            <td>John</td>
            <td>2</td>
            <td>800</td>
            <td>4</td>
        </tr>
        <tr>
            <td>Sally</td>
            <td>5</td>
            <td>610</td>
            <td>9</td>
        </tr>
        <tr>
            <td>Bob</td>
            <td>7</td>
            <td>249</td>
            <td>3</td>
        </tr>
    </tbody>
</table>

<table id="id2" style="margin-top:1em;">
    <tbody>
        <tr>
            <td>John</td>
            <td>2</td>
            <td>800</td>
            <td>4</td>
        </tr>
        <tr>
            <td>Sally</td>
            <td>5</td>
            <td>610</td>
            <td>9</td>
        </tr>
        <tr>
            <td>Bob</td>
            <td>7</td>
            <td>249</td>
            <td>3</td>
        </tr>
    </tbody>
</table>

JavaScript

//function included in selection
$('#id1 tbody tr').find('td:eq(2)').text(
function(i,t){
	return Math.round((parseInt(t,10) / 60)*100)/100;
});

//function broken out
$('#id2 tbody tr').find('td:eq(2)').text(minutesToHours());

function minutesToHours(i,t){
	return Math.round((parseInt(t,10) / 60)*100)/100;
}