try this:
$('#button').click( function () {
alert($("#example tr.selected").index());
alert($("#example tr.selected td:first-child").html());
});
it will alert index started from 0.
live demo
Question
Hello and thanks for helping me.
How can i get the currently selected row of my table? I need the number of this selected row, because i want to send it to the server
Look at this live example:
http://live.datatables.net/qexevaj/7/edit
If i select a row and click on the button above the table the alert says ' Object object'. How can i solve this?
La solution
try this:
$('#button').click( function () {
alert($("#example tr.selected").index());
alert($("#example tr.selected td:first-child").html());
});
it will alert index started from 0.
live demo