Answer the question
In order to leave comments, you need to log in
How to make ajax move to new comment in rails app?
I'm sorry for another stupid question, I'm just learning)
There are comments in the rails application for the post, they are created without refreshing the page.
here is my create.js.erb
$('#comments_<%= @post.id %>').append("<%= escape_javascript(render 'comments/comment', comment: @comment) %>");
$('#comment_title').val('');
$('#comment_text').val('');
$('#commentModal').modal('hide')
Answer the question
In order to leave comments, you need to log in
$("html, body").animate({scrollTop: $("#comment_<%= @comment.id %>").offset().top});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question