<p dir="auto">I am using a modal with the remote option. I'd like to be able to execute some code once the modal-body is loaded.</p>
<p dir="auto">Currently the only events we have available is <code class="notranslate">show</code> and <code class="notranslate">shown</code>. I tried using <code class="notranslate">shown</code> but loading the modal-body occurs after the shown event is fired.</p>
<p dir="auto">How could I achieve this?</p>
<p dir="auto">I think it is a good idea to add 'loaded' callback to modals. Something like that:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="    this.options.remote &amp;&amp; this.$element.find('.modal-body').load(this.options.remote, $.proxy(function() {
      this.$element.trigger('loaded')
    }, this))"><pre class="notranslate">    <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">options</span><span class="pl-kos">.</span><span class="pl-c1">remote</span> <span class="pl-c1">&amp;&amp;</span> <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">$element</span><span class="pl-kos">.</span><span class="pl-en">find</span><span class="pl-kos">(</span><span class="pl-s">'.modal-body'</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">load</span><span class="pl-kos">(</span><span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">options</span><span class="pl-kos">.</span><span class="pl-c1">remote</span><span class="pl-kos">,</span> <span class="pl-s1">$</span><span class="pl-kos">.</span><span class="pl-en">proxy</span><span class="pl-kos">(</span><span class="pl-k">function</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
      <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">$element</span><span class="pl-kos">.</span><span class="pl-en">trigger</span><span class="pl-kos">(</span><span class="pl-s">'loaded'</span><span class="pl-kos">)</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span> <span class="pl-smi">this</span><span class="pl-kos">)</span><span class="pl-kos">)</span></pre></div>
<p dir="auto">Here's complete code <a href="https://gist.github.com/3486192">https://gist.github.com/3486192</a><br>
I can make pull request if this functionality is really needed.</p>