My views/comments/create.js.erb JS is not working and my erb does give some output, I setup my jQuery by adding
gem 'jquery-rails', '~> 4.4'
I bundles my rails app and made changes in the app/asset/javascript/application.js with the requires as follows
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .
//= require activestorage
So when i write my js for create action of comment in app/views/comments/create.js.erb
$('#comment_content').val('')
$('#comment_div').prepend(<%= j render @comment %>)
And i have a partial with _comment.html.erb
<%= comment.created_at.strftime("%l:%M:%p")%>
<b><%= comment.user.username %></b>
<%= comment.content %>
<br>
Now i dont know where i have made mistake in setting up my jquery
The answer to this is to use "" in the prepend function just like
$('#comment_content').val('')
$('#comment_div').prepend("<%= j render @comment %>")