JSFiddle - React, Tailwind, and code Playground

Dynamic number cells

by Dave

HTML

<table border="1">
    <tr>
        <td>blue</td>
    </tr>
    <tr>
        <td class="zzzz">red</td>
    </tr>
    <tr>
        <td>black</td>
    </tr>
</table>
<input value='add' type='submit' onclick='aaa();' />

JavaScript

//$(".zzzz").each( function() {
    //$(this).tooltip();
//    $(this).alert("ddd");
//});
function aaa(){


var table = document.getElementsByTagName('table')[0],
    rows = table.getElementsByTagName('tr'),
    text = 'textContent' in document ? 'textContent' : 'innerText';
console.log(text);

for (var i = 0, len = rows.length; i < len; i++){
    rows[i].children[0][text] = i + ': ' + rows[i].children[0][text];
}

}