I have a data table which I retrieved from MySQL table. Before begin delete action for each row I want to give alert when delete button is pressed after selection of row. this is my java script code.
$(function() {
$('#dataTables-example tbody').on('click', 'tr', function() {
var name = $('td', this).eq(0).text();
$('#btnDeleteRow').click(function(e) {
alert('You are going to delete ' + name + '\'s row');
});
});
});
It works. But the problem is I want only the last clicked row id to alert. My code gives all the row ids' i have clicked before I refresh the page. As I am new to jQuery please help me. Thanks.
Aucun commentaire:
Enregistrer un commentaire