title: Rails, trying to fill a modal content with jQuery
body: <p>Due to some reasons, I have to fill a Bootstrap-modal's content with jQuery.
  In my view I got simply:</p>
  
  <pre><code>&lt;div class = "modal fade" id="editArticleForm"&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I have an edit button which calls the edit function in my controller:</p>
  
  <pre><code>def edit
  
          respond_to do |format|
              format.js
          end     
  end
  </code></pre>
  
  <p>My edit.js.erb:</p>
  
  <pre><code>$('#editArticleForm').html('&lt;%= j(render partial: "articles/modals/editModalPartial")%&gt;');
  $('#editArticleForm').modal('show');
  </code></pre>
  
  <p>And my partial to fill the modal:</p>
  
  <pre><code>&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-label=""&gt;
            &lt;span&gt;&amp;times;&lt;/span&gt;
          &lt;/button&gt;
          &lt;h4 class="modal-title"&gt;
            Edit Article                
          &lt;/h4&gt;
  
        &lt;/div&gt;
        &lt;div class="modal-body" style="max-height: 1000px;"&gt;
  
  
          &lt;%=form_for @article, url: articles_create_path,remote: true, html: {class: "form-horizontal"} do |f|%&gt;
  
          &lt;fieldset class="content-group"&gt;
            &lt;legend class="text-bold"&gt;Images&lt;/legend&gt;
            &lt;div class="form-group"&gt;
              &lt;label class="col-lg-2 text-semibold"&gt;Current image:&lt;/label&gt;
              &lt;div class="col-lg-10"&gt;
                &lt;%= image_tag @article.image_url(:thumb)%&gt;
              &lt;/div&gt;
            &lt;/div&gt;
  
  
            &lt;div class="form-group"&gt;
              &lt;label class="col-lg-2 text-semibold"&gt;Change image:&lt;/label&gt;
              &lt;div class="col-lg-10"&gt;
                &lt;%= f.file_field :image, :class =&gt; 'file-input-custom', 'data-show-caption' =&gt; true, 'data-show-upload' =&gt; false, :accept =&gt; 'image/*'%&gt;
              &lt;/div&gt;
            &lt;/div&gt;
  
          &lt;/fieldset&gt;
          &lt;%= f.fields_for :strings do |fa| %&gt;
          &lt;fieldset class="content-group"&gt;
            &lt;legend class="text-bold"&gt;Localization&lt;/legend&gt;
            &lt;div class="tabbable"&gt;
  
              &lt;div class="tab-content"&gt;
                &lt;% @languages.each do |lang| %&gt;
                &lt;%= fa.fields_for lang.id.to_s do |fb| %&gt;
  
                &lt;div class="tab-pane active" id="basic-justified-tab-&lt;%= lang.id %&gt;"&gt;
                  &lt;div class="form-group"&gt;
                    &lt;label class="col-lg-2 control-label text-semibold"&gt;&lt;%= lang.name %&gt; Title: &lt;span class="text-danger"&gt;*&lt;/span&gt;&lt;/label&gt;
                    &lt;div class="col-lg-10"&gt;
                      &lt;%= fb.text_field :title, :class =&gt; 'form-control', :required =&gt; 'required' %&gt;
                    &lt;/div&gt;
                  &lt;/div&gt;
  
                  &lt;div class="form-group"&gt;
                    &lt;label for="title" class="col-md-4 col-md-offset-1"&gt;&lt;%= lang.name %&gt; Text:&lt;/label&gt;
                    &lt;%= fb.text_area :text, :style =&gt; "height: 250px;", :class =&gt; 'wysihtml5 wysihtml5-min form-control', :required =&gt; 'required' %&gt;
                  &lt;/div&gt;
                &lt;/div&gt;
                &lt;hr&gt;
  
                &lt;% end %&gt;
                &lt;% end %&gt;
              &lt;/div&gt;
            &lt;/div&gt;
  
          &lt;/fieldset&gt;
          &lt;% end %&gt;                              
  
          &lt;div class="form-group"&gt;
  
            &lt;div class="col-md-2 col-md-offset-8"&gt;
              &lt;input type="submit" class="btn btn-success" value="Submit" &gt;
            &lt;/div&gt;
  
          &lt;/div&gt;
  
          &lt;% end %&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  </code></pre>
  
  <p>The rest of the screen gets blackened out, but the modal does not popup.</p>
  
  <p>What am I doing wrong?</p>
  
  <p>If you can suggest a better way to load the modal with content I will be glad to hear it.</p>
  
  <p>Any help appreciated.</p>