title: Creating a modal dialog on the fly in Bootsrap3
body: <p>Is there any way I can create on the fly a modal dialog starting from a DOM node or a AJAX call?</p>
  
  <p>Right now, I have to put </p>
  
  <pre><code>&lt;!-- Modal --&gt;
    &lt;div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"&gt;
      &lt;div class="modal-dialog"&gt;
        &lt;div class="modal-content"&gt;
          &lt;div class="modal-header"&gt;
            &lt;button type="button" class="close" data-dismiss="modal" aria-hidden="true"&gt;&amp;times;&lt;/button&gt;
            &lt;h4 class="modal-title"&gt;Modal title&lt;/h4&gt;
          &lt;/div&gt;
          &lt;div class="modal-body"&gt;
            ...
          &lt;/div&gt;
          &lt;div class="modal-footer"&gt;
            &lt;button type="button" class="btn btn-default" data-dismiss="modal"&gt;Close&lt;/button&gt;
            &lt;button type="button" class="btn btn-primary"&gt;Save changes&lt;/button&gt;
          &lt;/div&gt;
        &lt;/div&gt;&lt;!-- /.modal-content --&gt;
      &lt;/div&gt;&lt;!-- /.modal-dialog --&gt;
    &lt;/div&gt;&lt;!-- /.modal --&gt;
  </code></pre>
  
  <p>```</p>
  
  <p>I would like something like</p>
  
  <pre><code>&lt;img src='' id="x"&gt;
  &lt;script&gt;
  $('#x').modal({title:'Image',otherOption:true});
  &lt;/script&gt;
  </code></pre>