<span> jQuery .click() not working
use .on()
As your span is added dynamically so it is not present at the time DOM ready or page load.
So you have to use Event Delegation
Syntax
$( elements ).on( events, selector, data, handler );
like this
$(document).on('click','.delete_button',function(){
// code here
});
or
$('parentElementPresesntAtDOMready').on('click','.delete_button',function(){
// code here
});
your code becomes
$(document).ready(function () {
$(document).on('click', '.delete_button', function () {
var transaction_id = $(this).attr('id').replace('delete_', '');
alert("Delete transaction #" + transaction_id);
return false;
});
});
It seems like the span is dynamically created, you need to use event delegation. Bind it to the closest static parent or document
$(document).on('click','.delete_button',function(){
/*Your code*/
});