It seems that I mistakenly created two modals. The issue arises when I open either of them for the first time and then close it, as from that point on, neither modal is able to be opened again by performing the same action that initially worked.
https://i.sstatic.net/hxJLj.png Here is the snippet of my javascript code:
<script>
$(document).ready(function()
{
$("#accountsTable").tablesorter();
$('#newAccount').on('click', function() {
$.ajax({
async:true,
url: '/crm/accounts/create_account_modal',
success: function(res)
{
$('.createAccountModalBody');
alert(res);
$('#createAccountModal').modal({show:true});
$('.createAccountModalBody').html(res);
}});
});
$('tr').on('dblclick', function() {
var AccountID = $(this).find('td').first().html();
alert(AccountID);
$('.editAccountModalBody').load('/crm/accounts/edit_account/1');
$('#editAccountModal').modal('show');
});
$('#editAccountModal').on('hidden.bs.modal', function () {
$(this).removeData('bs.modal');
$(this).empty();
$(this).removeAttr('style');
});
$('#createAccountModal').on('hidden.bs.modal', function () {
$(this).removeData('bs.modal');
$(this).empty();
$(this).removeAttr('style');
});
});
$('tr').on('dblclick', function() {
var AccountID = $(this).find('td').first().html();
alert(AccountID);
$('.editAccountModalBody').load('/crm/accounts/create_account_modal');
$('#editAccountModal').modal('show');
});
</script>