JavaScript code using the modal methods to toggle the showing and hiding of the modals code example
Example 1: close bootstrap modal with javascript
$('#myModal').modal('hide');
Example 2: html data-target modal
$('#myModal').modal('show')
$('#myModal').modal('hide');
$('#myModal').modal('show')