I am trying to have a twitter-bootstrap modal dialog box appear on page load for a certain view. I am doing this using the code:
<script>
$(window).load(function(){
$('#shareModal').modal('show');
});
</script>
<div class="modal hide fade" id="shareModal">
<div class="modal-header">
<a class="close" data-dismiss="modal">×</a>
<h3>Modal header</h3>
</div>
<div class="modal-body">
<p>One fine body…</p>
</div>
<div class="modal-footer">
<a href="#" class="btn">Close</a>
<a href="#" class="btn btn-primary">Save changes</a>
</div>
</div>
On page load, instead of the modal popping up, the screen appears "greyed" out (faded) and nothing appears. Anyone have any idea what could be going on? Thank you.
Hmmm, I think that you should try this with Bootstrap 3:
in your browser's console just type: $('#shareModal').modal(); to test your modal
JS
DEMO