Reputation: 65
I have the following code:
$('body').on('click','#confirm_remove',function(){
alert($(this).data('whattoremove'));
});
The #confirm_remove
is a button id inside a bootstrap modal, who's data attribute (whattoremove) gets updated every time the modal opens - this is verified, but for some reason the data in the jQuery function has the same value on every click - this is the value of the first time it was clicked.
Any ideas on how to fix this.
Upvotes: 0
Views: 77
Reputation: 2889
try this:
$('#confirm_remove').click(function(){
alert( $('#confirm_remove').attr('whattoremove') );
});
Upvotes: 1