I have created a modal pop up using JavaScript.
The HTML for the modal is in a get_template_part("content",
"contact")` file.
The issue is, only on the home page does the modal pop up Through a click method.
When I visit another page, the modal doesn't pop up open.
How can I solve this issue?
Below is my JavaScript code:
$("#contactModal").click(function() {
$('#myModal').show();
});
$(".close").click(function() {
$("#myModal").hide();
});
Here, my HTML code:
<!-- Contact -->
<div id="contactModal" class="contactWrapper">
<div class="contactText">
<a><p>You think we're cool? <br><span>Let's Get in touch.</span></p></a>
</div>
</div><!-- end blogContainer -->
<!-- The Modal -->
<div id="myModal" class="modal">
<div class="modal-content">
<span class="close">×</span>
<?php echo do_shortcode( '[contact-form-7 id="143" title="Main Contact Form"]' ); ?>
</div>
</div>
functions.php
file?