How to identify id of modal window in this JS
$('.modal-Goalkeepers, .modal-Defenders, .modal-Midfielders, .modal-Forwards').on('show.bs.modal', function (data) {
var id = {{here I want to know id of modal is now shown}}
});
you can try this :
$('.modal-Goalkeepers, .modal-Defenders, .modal-Midfielders, .modal-Forwards').on('show.bs.modal', function(data) {
var id = $(this).attr('class');
});
an example :
$('.block1,.block2,.block3').click(function() {
alert($(this).attr('class'));
});
.block1,.block2,.block3 {
height:100px;
margin:20px;
background:#000;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="block1"></div>
<div class="block2"></div>
<div class="block3"></div>
UPDATE : he need to get the class and not the id !