I'm having trouble figuring out why the code below isn't working for me. The console is showing 'undefined' for data-id.
href='#detailsModal' class='btn btn-info btn-xs' data-toggle='modal' data-id='xyz'>BUTTON NAME
JAVASCRIPT
$('#detailsModal').on('show.bs.modal', function (e) {
console.log($(e.relatedTarget).data('id'));
});
I was expecting the console output to be 'xyz'