I’m launching a bootstrap modal using a button and then changing the button class and text via jQuery. I want to launch another bootstrap modal once the button class is changed.
Here is my code
$('.btn myBtn1').click(function () {
var id = $(this).closest('tr').data('id');
$('#myModal1').data('id', id).modal('show');
$('. btn').addClass(' myBtn2');
$('. btn').removeClass(' myBtn1');
});
//second modal code
$('.btn myBtn2').click(function () {
var id = $(this).closest('tr').data('id');
$('#myModal2').data('id', id).modal('show');
$('. btn').addClass(' myBtn1');
$('. btn'). removeClass(' myBtn2');
});
My issue is its launching the same modal. Modal 1 and never loads the modal two. What should I do to fix this? Appreciate your time.