未在rails视图中加载javascript

未在rails视图中加载javascript,javascript,jquery,ruby-on-rails,Javascript,Jquery,Ruby On Rails,这是我的观点_micropost.html.erb <button type="button" class="answer-button">Respond</button> <section class="answer-form"> <%= render 'shared/answer_form',micropost: micropost %> </section>

这是我的观点_micropost.html.erb

       <button type="button" class="answer-button">Respond</button>
        <section class="answer-form">
          <%= render 'shared/answer_form',micropost: micropost %>
        </section>
        <script type="text/javascript">
        $(document).ready(function(){
            $(.answer-button).click(function(){
              $(.answer-form).slideDown();
            });
        });
        </script> 
响应
$(文档).ready(函数(){
$(.answer按钮)。单击(函数(){
$(.answer form.slideDown();
});
});
当我点击按钮时,表单应该向下滑动。但它不起作用


这是因为在DOM选择器中缺少双引号

如果在
脚本
标记中有输入错误,应该是

<script type="text/javascript">
希望这有帮助

<script type="text/javascript">    
  $('body').on('click', '.answer-button', function(){
    $('.answer-form').slideDown();
  });
</script>