Uncaught SyntaxError: '' string literal contains an unescaped line break

I am using Ruby on Rails.

create.js.erb

$('#my_re_ap').html('<%= recaptcha_element('signup')%>');

but I am getting a Uncaught SyntaxError: '' string literal contains an unescaped line break error.

My view helper looks like this. I am using the recaptcha gem.

helper

  def recaptcha_element(event_name)
    if @show_checkbox_recaptcha
      content_tag :div, class: "pb-2" do
        recaptcha_tags
      end
    else
      recaptcha_v3(action: event_name, site_key: 'key123')
    end
  end

What is wrong with my syntax?

10 thoughts on “Uncaught SyntaxError: '' string literal contains an unescaped line break”

  1. I know this if off topic but I’m looking into starting my own weblog and was
    curious what all is required to get set up? I’m assuming having a blog like yours would cost
    a pretty penny? I’m not very web smart so I’m
    not 100% positive. Any tips or advice would be greatly
    appreciated. Cheers

    Reply

Leave a Comment