twitter bootstrap - html modal in javascript -
i'm using display modal.
<script> mousetrap.bind('j e f f r e y enter', function() { $('#mymodal').modal('show') }); </script>
normally button used.
<a data-toggle="modal" class="btn btn-info" href="remote.html" data-target="#mymodal">click me !</a>
is there way modal html page , call using javascript?
you can send ajax request html code modal, append document.
<script> var $modal = undefined; mousetrap.bind('j e f f r e y enter', function() { if($modal === undefined) { $.get('path/to/modal.html', function(data)){ if($modal === undefined) { $modal = $(data); $('body').append($modal); } $modal.modal('show'); }); return; } $modal.modal('show') }); </script>
Comments
Post a Comment