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 8147457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:21:30+00:00 2026-06-06T14:21:30+00:00

I have a js.erb with this basic content: $(#currencies).html(<%= options_for_select([[‘Dollar’, ‘$’]])%>); And the html

  • 0

I have a js.erb with this basic content:

$("#currencies").html("<%= options_for_select([['Dollar', '$']])%>");

And the html is not being added to the element #currencies.

However if I do it like this:

$("#currencies").html('<option value="$">Dollar</option>');

The html is being updated.

What can be happening?

For debugging purposes I have tried this:

alert("<%= options_for_select([['Dollar', '$']]) %>");

And it doesn’t show anything either.

  • 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-06-06T14:21:33+00:00Added an answer on June 6, 2026 at 2:21 pm

    You need to escape javascript with <%=j .. %>

    <%=j options_for_select .. %>
    

    or

    <%= escape_javascript(..) %>
    

    or

    $('some_element').replaceWith('<%=j render 'some/element_template' %>');
    

    from api documentation

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code in a .html.erb file: <script src=http://connect.facebook.net/en_US/all.js#xfbml=1></script> <script> FB.Event.subscribe('edge.create', function(response) {
I am using rails beta 3 and I have a erb page named index.html.erb
I want to render for facebook bot special data. I have og.html.erb <!DOCTYPE html><html><head>
I have the following in a html.erb file: <%= @location_list = [['test',2]] %> <script
I have 3 files: index.html.erb is my homepage inside the index I render a
I have a Rails 2.1.2 site that only has html templates e.g. jobs.html.erb, so
When editing a basic User model in Rails from the edit.html.erb form, I would
Suppose I have a Ruby ERB template named my_template.html.erb , and it contains the
this is probably a very basic question. I have installed rails 3 and generated
Using Rails 3.2.0.rc2 and ruby 1.9.3p0 In app/views/requests/_form.html.erb I have the following code for

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.