this view partial _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> when click on button, form should slide down. not working .
it due tomissing double quotes in dom selector
you have typo in script tag, should be
<script type="text/javascript"> also, $(.answer-button) , $(.answer-form) wrong, class should passed string, should $('.answer-button') , $(.answer-form)!
fix typo try this
<script type="text/javascript"> $('body').on('click', '.answer-button', function(){ $('.answer-form').slidedown(); }); </script> hope helps!
Comments
Post a Comment