I cant get the data-id attribute value to show in the modal when button is clicked
Here is my button:-
<a class="btn btn-default btn-sm" id="delcompanybtn" data-href="/deletecompany.php?companyid=' + data[0] + '" data-toggle="modal" data-target="#confirm-delete" data-id=' + data[0] + '" ></a>
Here is my Jquery
code:-
$('#delcompanybtn').on('show.bs.modal', function (e) {
var companyid = $(e.relatedTarget).attr('data-id');
$('#showcompanyid').html(companyid);
});
Here is my modal body code:-
<div class="modal-body">
Delete Company ID : <span id="showcompanyid"></span> ?
</div>
Silly little things like this just bug me, any help is appreciated!