Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 824467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:06:18+00:00 2026-05-15T03:06:18+00:00

In my layout I have <% @current_user.popups.each do |p| %> <% content_for :script do

  • 0

In my layout I have

<% @current_user.popups.each do |p| %>
  <% content_for :script do %>
    <%= "$(document).ready ( function() { $.jGrowl(\"#{p.message}\", { sticky: true }) });" %>
  <% end %>
<% end %>

And then in the script section I have

<%= yield :script %>

The problem is that this renders the escaped quotes as \&quot; and javascript doesn’t like this.

How can I stop this from happening? Or is there another approach to this? I can’t use single quotes because I’d like to have some html in the message. I’d appreciate any help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T03:06:18+00:00Added an answer on May 15, 2026 at 3:06 am

    Are you using Rails 3? In Rails 3 html escaping is done by default and you must bypass it each time like the following: jdl had the right idea above, but it sounds like you still have issues.

    <% content_for :script do %>
      $(document).ready ( function() { $.jGrowl("<%= raw(p.message) %>", { sticky: true }) });
    <% end %>
    

    But even better would be to run it through the helper provided by rails: escape_javascript so escape carriage returns and quotes

    like this:

    $(document).ready ( function() { $.jGrowl("<%= raw(escape_javascript(p.message)) %>", { sticky: true }) });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following in my application_controller.rb def layout unless request.subdomain.empty? && current_user.nil? self.class.layout
I am trying to figure out how to make my layout have the following
I'm trying to build this layout: I have this at this time: http://jsfiddle.net/Gh6mB/12/ The
here is my mysql and php code layout: I have 3 tables tableA stores
Help needed.. I have a organization layout which have rectangular shapes not in an
How to align the buttons bottom of the screen.In the layout i have header
I'm thinking about putting a .txt file in res/drawable or in res/layout to have
I have a Layout containing a fragment. I set width of Layout to let's
I have this layout: <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=match_parent android:layout_height=wrap_content android:orientation=horizontal android:gravity=left> <LinearLayout android:layout_width=wrap_content android:layout_height=wrap_content android:orientation=horizontal>
I have a layout like this in which I want to display a label

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.