Getting onClick event on link inside the table
Getting onClick event on link inside the table
I'm trying to attach a function to the Click event on a link in a cell. It's a delete button. I want it to ask the user to ask the question if it is ok to delete the row.
With fnRender I alter the data so a delete icon will appear.
[code]
"fnRender": function ( oObj ) { return ''; }
[/code]
With jquery I try to attach the function to confirm like so
[code]
$(".deleteMyRow").click(function() {
var str = $(this).attr('title');
var answer = confirm(str + " ,weet u het zeker?");
if (!answer) return false;
});
[/code]
Obviously since I use server side processing data the click function never gets attached to the link.
My question is, how or in which function of the datatable do I put the jquery click event handler? I searched the documentation but somehow I couldn't find it or I overlooked it. This should be a pretty common thing but I can't seem to find it in the docs.
Kind regards,
Jeroen
With fnRender I alter the data so a delete icon will appear.
[code]
"fnRender": function ( oObj ) { return ''; }
[/code]
With jquery I try to attach the function to confirm like so
[code]
$(".deleteMyRow").click(function() {
var str = $(this).attr('title');
var answer = confirm(str + " ,weet u het zeker?");
if (!answer) return false;
});
[/code]
Obviously since I use server side processing data the click function never gets attached to the link.
My question is, how or in which function of the datatable do I put the jquery click event handler? I searched the documentation but somehow I couldn't find it or I overlooked it. This should be a pretty common thing but I can't seem to find it in the docs.
Kind regards,
Jeroen
This discussion has been closed.
Replies
Allan