JSFiddle - React, Tailwind, and code Playground

by Tilwin Joy

HTML

<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.0/jquery-ui.min.js"></script>
<table>
    <thead>
        <tr>
            <th>heading1</th>
            <th id="0">heading2</th>
            <th>heading11</th>
            <th id="1">heading12</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>data1</td>
            <td>data2</td>
            <td>data3</td>
            <td>data4</td>
            <td>data5</td>
            <td>data6</td>
        </tr>
        <tr>
            <td>data1</td>
            <td>data2</td>
            <td>data3</td>
            <td>data4</td>
            <td>data5</td>
            <td>data6</td>
        </tr>
    </tbody>
</table>

CSS

#sortable {
    width:200px;
    height:200px;
    background:hotpink;
}

JavaScript

var index= $("#0").index();
$("table").on("click", "tr td:nth-child("+(++index)+")", function () {
        alert("click");
})