title: RAILS 5 Javascript not working on remote true method
body: <p>Im trying to render a create.js.erb on Rails 5 when I call create action of comments on my app, I can't get it to work and I'm running out of time, I will really thank your help. This is my code:</p>
  
  <p><strong>My Comments_Controller (part of it):</strong></p>
  
  <pre><code>class CommentsController &lt; ApplicationController
    before_action :set_comment, :set_replies, only: [:show, :edit, :update,:destroy]
    before_action :set_congress, :set_category, :set_presentation
    before_action :authenticate_user!, except: [:index, :show]
    respond_to :js, :html
    layout "insideapplication"
    # GET /comments
    # GET /comments.json
    def index
      @comments = Comment.all
      @comment = Comment.new
    end
  
    def new
      @comment = Comment.new(:parent_id =&gt; params[:parent_id])
    end
  
   def create
     @comment = Comment.new(comment_params)
     @comment.author_id = current_user.id
     @comment.presentation = @presentation
  
     respond_to  do |format|
        if @comment.save
          format.html { redirect_to  [@congress, @category, @presentation],notice: 'Comment was successfully created.' }
          format.json { render :show, status: :created, location: @comment }
          format.js 
        else
          format.html { render :new }
          format.json { render json: @comment.errors, status: :unprocessable_entity }
          format.js 
        end
      end
    end
  </code></pre>
  
  <p><strong>My index.html.erb (Comments)</strong></p>
  
  <pre><code>&lt;div class="container"&gt;
      &lt;div class="row"&gt;
        &lt;div class="text-center"&gt;
            &lt;!-- Button trigger modal --&gt;
            &lt;button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#mynewpost"&gt;
              New Post
            &lt;/button&gt;
        &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;br&gt;
      &lt;hr&gt;
      &lt;div class="row" id="container_posts"&gt;
          &lt;%= render @posts %&gt;
      &lt;/div&gt;
      &lt;!-- Modal  create action --&gt;
        &lt;%= form_for(@post, remote: true) do |f| %&gt;
            &lt;div class="modal fade" id="mynewpost" 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-label="Close"&gt;&lt;span aria-hidden="true"&gt;&amp;times;&lt;/span&gt;&lt;/button&gt;
                &lt;h4 class="modal-title" id="myModalLabel"&gt;Post&lt;/h4&gt;
              &lt;/div&gt;
              &lt;div class="modal-body"&gt;
                &lt;div class="field"&gt;
                  &lt;%= f.label :title %&gt;&lt;br&gt;
                  &lt;%= f.text_area :title, class: "form-control post_title" %&gt;
                &lt;/div&gt;
                &lt;div class="field"&gt;
                  &lt;%= f.label :content %&gt;&lt;br&gt;
                  &lt;%= f.text_area :content, class: "form-control post_content" %&gt;
                &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="modal-footer"&gt;
                &lt;button type="button" class="btn btn-default" data-dismiss="modal" id="mynewpostclose"&gt;Close&lt;/button&gt;
                &lt;%= submit_tag "Create", class: "btn btn-primary" %&gt;
              &lt;/div&gt;
            &lt;/div&gt;
          &lt;/div&gt;
          &lt;/div&gt;
        &lt;% end %&gt;
      &lt;!-- Modal --&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>My create.js.erb (testing js only)</strong></p>
  
  <pre><code>alert("test!!!");
  </code></pre>