0
Good afternoon,
I have this code that generates me a Modal Box, however it is not working:
jQuery(function() {
var modalHtml =
'<div id="open-modal" class="modal-window">' +
' <div>' +
' <a href="#" title="Close" class="modal-close">Close</a>' +
' <h1>Voilà!</h1>' +
' <div>A CSS-only modal based on the :target pseudo-class. Hope you find it helpful. <a href="#" target="_blank">Say hello on Twitter.</a></div>' +
' </div>' +
'</div>';
// insert HTML dynamically
jQuery(".modal-dialog").html(modalHtml);
// display
jQuery(".modal-dialog").modal('show');
// append a new element to the DOM
jQuery('body').after('<div class="modal-dialog modal"></div>');
});;
What can I change to make it work? I also wanted to refresh the page so that it always runs the code.
Hello, thanks for the help but when tested gave this error: jQuery(...). modal is not a Function
– CSAnimor
check if you are calling the files in the correct sequence Ex:
<!-- jQuery -->
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<!-- BS JavaScript -->
<script type="text/javascript" src="js/bootstrap.js"></script>
– Mateus
Yes everything is correct, but continues to generate this error :/
– CSAnimor
I believe it is something with your jquery. I tested it here and it works
– Mateus
It already works :) thanks for the help
– CSAnimor