For some reason, when I use link_to in my show.js.erb file, the javascript does not work...
This works:
$(".commentvotecount<%= params[:commentid]%>").html("<%= positiveVoteCount = @comment.plusminus %>");
This doesn't:
$(".commentvotecount<%= params[:commentid]%>").html("<%= positiveVoteCount = @comment.plusminus %> <%= link_to 'About', '/about' %>");
What is going wrong?
Thank you.
use escape_javascript so quotes are escaped.
$(".commentvotecount<%= params[:commentid]%>").html("<%= escape_javascript link_to('About', '/about') %>");