for example:
<table>
<tr><td>1,1</td><td>2,1</td></tr>
<tr><td>2,1</td><td>2,2</td></tr>
</table>
I wanna using the following function:
$("td").click(function(){
alert(xxxx)
})
to get the <td>
`s position when clicked, but how?
Thanks.
for example:
<table>
<tr><td>1,1</td><td>2,1</td></tr>
<tr><td>2,1</td><td>2,2</td></tr>
</table>
I wanna using the following function:
$("td").click(function(){
alert(xxxx)
})
to get the <td>
`s position when clicked, but how?
Thanks.
$("td").click(function(){
var column = $(this).parent().children().index(this);
var row = $(this).parent().parent().children().index(this.parentNode);
alert([column, ',', row].join(''));
})