This question has been answered by bendy4. See the first response.
It looks like what is happening is that you specify the modal pop-up HTML in the &successMessage property of the FormIt snippet call.
Then, at the bottom of the page, you have the code to trigger the modal pop-up.
This javascript code will run on every page load, but unless FormIt has inserted the successMessage HTML, it won't find the div to pop up.
Once you have successfully submitted the form, FormIt inserts the successMessage HTML, and the javascript does find the modal div and operates on it.
<div id="modal" class="modal hide fade">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3>Modal header</h3>
</div>
<div class="modal-body">
<div class="alert alert-success marginTop25">
<button type="button" class="close" data-dismiss="alert">×</button>
<h3>Your comment has been submitted successfully, please check your email.</h3>
</div>
</div>
<div class="modal-footer">
<a href="#" class="btn">Close</a>
</div>
</div>You can see the exact HTML to put in the successMessage property if you view the source of the page that loads after you submit the form in his demo.
<div id="modal" class="modal hide fade"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h3>Modal header</h3> </div> <div class="modal-body"> <div class="alert alert-success marginTop25"> <button type="button" class="close" data-dismiss="alert">×</button> <h3>Your comment has been submitted successfully, please check your email.</h3> </div> </div> <div class="modal-footer"> <a href="#" class="btn">Close</a> </div> </div>
<script>
$(document).ready(function(){
$('#modal').modal('show');
})
</script>Again, if you look at the source of the modal demo page, you'll see the activation javascript at the bottom of the source, after the jquery and bootstrap libraries are loaded:
<script> $(document).ready(function(){ $('#modal').modal('show'); }) </script>