I have the following in the .js.erb file returned after submitting form c remote: true.
create.js.erb
$("#flash-notices").html(" <%= escape_javascript(render(partial: "/shared/flash_messages", locals: { form_errors: @artist.errors.full_messages } )) %> ");
$("#flash-notices").fadeIn(300).delay(3000).fadeOut(300);
...
However, what returns to the browser is:
<textarea data-type="text/javascript" response-code="200">
$("
$("
...
</textarea>
How can I stop the first level of JS escaping that stops jQuery execution?
source
share