I want to show a twitter bootstrap modal as a response to a JS request. My show.js.erb function looks something like this:
$(document).ready(function() {
$('#dialog').modal('show')
});
Here "dialog" is the modal's id. The modal code itself looks something like this:
<div id="dialog" class="modal hide fade">
<div class="modal-header">
<a href="#" class="close">×</a>
<h3> Showing Modal </h3>
</div>
<div class="modal-body">
I need to show up!
</div>
<div class="modal-footer">
<a href="#" class="btn primary">Done</a>
</div>
</div>
One thing I am sure of is that the javascript is being called. I can have it alter items on the page. Another thing is that modal is working fine. It shows up just fine when I use an HTML button to trigger the request like this:
<button data-controls-modal="dialog" data-backdrop="true" data-keyboard="true" class="btn danger"> Show </button>
Any idea why the modal doesn't show up on JS request?
Thank You!
I am not aware of a jquery "modal" function. It looks like you are trying to get the element#dialog to show up. You could simply do:
Or am I totally missing the question?