javascript & jquery

[jQuery] 클릭한 td에 alert

sup2is 2018. 11. 28. 13:35










table작업하시는 분들에게 매우 유용하지 않을까 싶습니다

클릭한 td의 rownum과 colnum을 넘겨주는 소스입니다.



$('td').click(function(){

  var col = $(this).parent().children().index($(this));

  var row = $(this).parent().parent().children().index($(this).parent());

  alert('Row: ' + row + ', Column: ' + col);

});



https://stackoverflow.com/questions/788225/table-row-and-column-number-in-jquery

https://stackoverflow.com/questions/788225/table-row-and-column-number-in-jquery

https://stackoverflow.com/questions/788225/table-row-and-column-number-in-jquery