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

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -