JSFiddle - React, Tailwind, and code Playground

by Ian Roberts

HTML

<table>
<tbody>
<tr>
</tr>
</tbody>
</table><table>
<tbody>
<tr>
</tr>
</tbody>
</table><table>
<tbody>
<tr>
</tr>
</tbody>
</table><table>
<tbody>
<tr>
</tr>
</tbody>
</table><table>
<tbody>
<tr>
</tr>
</tbody>
</table>

CSS

table {
    height:30px;
    width:30px;
    background-color:#eaeaea;
}
.table1 {
    background-color:#333333;
}
.table2 {
    background-color:#fad400;
}
.table3 {
    background-color:#188879;
}
.table4 {
    background-color:#c3c3c3;
}

JavaScript

//ads class to the nth of a certain tag

//$(document).ready(function() {
        $("table").each(function(i) {
        $(this).addClass("table" + (i+1));
        });
//});

//via - http://stackoverflow.com/questions/2646058/jquery-addclass-1-2-3-etc-auto-to-a-list