'Modal only displays once, not after second click
I'm using Bootstrap modal to check if an element is available in a form. If no, it pops the modal. But after I closed the modal, and clicks the Submit button the second time, it won't pop again.
if (!document.getElementById("ipfs-cid")) {
$("#noFileModal").modal("show");
} else {
var data = {
action: "acadp_public_save_metadata",
ipfs_cid: document.getElementById("ipfs-cid").value,
filenames: filenames,
name: document.getElementById("acadp-title").value,
description: document.getElementById("description").value,
security: acadp.ajax_nonce,
};
....
Here's my modal, some near to
<div class="modal fade" id="noFileModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel"><?php esc_html_e( 'No File Uploaded', 'advanced-classifieds-and-directory-pro' ); ?></h5>
</div>
<div class="modal-body">
<?php esc_html_e( 'Please upload at least one file.', 'advanced-classifieds-and-directory-pro' ); ?>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
Any help for a newbie like me is highly appreciated.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
