I need index in each function which has class = index,
My desired result is 2 and 4 and 5, it is come from td element base index.
How can I get tdbase indexing?
If you have opinion,please let me know.
Thanks
$(".index").each(function(){
let index=$(this).index()+1
console.log(index);
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<table>
<tr>
<td>1</td>
<td class="index">2</td>
<td>3</td>
</tr>
<tr>
<td class="index">4</td>
<td class="index">5</td>
<td>6</td>
</tr>
</table>
.index()method to understand what it does?