Reputation: 196
I have this code in .php that retrieves a contact form:
echo '<div class="hsk-column4 hsk-agency-inquiry-form">';
echo hsk_agency_enquiry_form();
echo '</div>';
How can I make a popup appear with the contact form when pressing a button with id="btn-contact"
?
Thanks.
Upvotes: 0
Views: 674
Reputation: 101
You can do it with jQuery
PHP:
<button id="btn-contact">Open Contact</button>
<?php
echo '<div class="hsk-column4 hsk-agency-inquiry-form">';
echo hsk_agency_enquiry_form();
echo '</div>';
?>
jQuery:
jQuery(document).ready(function( $ ) {
$("body").on("click", function(){
$(".hsk-column4.hsk-agency-inquiry-form").removeClass("active-form");
});
$("#btn-contact").on("click", function(event){
$(".hsk-column4.hsk-agency-inquiry-form").addClass("active-form");
event.stopPropagation();
});
});
CSS:
.hsk-column4.hsk-agency-inquiry-form {
display: none;
}
.active-form {
display: block;
}
Upvotes: 1
Reputation: 89
Maybe you are talking about Modals? Should help...
https://getbootstrap.com/docs/4.0/components/modal/
Upvotes: 2