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

  • SEARCH
  • Home
  • 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 6215163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:00:20+00:00 2026-05-24T07:00:20+00:00

I have the following select_tag . <%= select_tag :days, options_for_select([Monday, Tuesday]) %> Somewhere, in

  • 0

I have the following select_tag.

<%= select_tag :days, options_for_select(["Monday", "Tuesday"]) %>  

Somewhere, in the view I defined the following variable.

<% @day_of_week = "Monday" %>

And showed it :

<%= @day_of_week %>

I would like to dynamically change @day_of week, after a value is selected from the select_tag.

  • 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-24T07:00:22+00:00Added an answer on May 24, 2026 at 7:00 am

    You can use jquery for this.

    Add this to the head of your html file (if you dont have jquery yet) :

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script>
    

    Wrap your text like this to give it an id :

    <div id="text_to_be_changed"><%= @day_of_week %></div>
    

    Give a specific id to your SELECT tab (if #days does not work for some reason).

    <%= select_tag :days, options_for_select(["Monday", "Tuesday"]), :id => "select_days" %>  
    

    Then add this unobtrusive JavaScript to the end of your view.
    Any change to the select#days will trigger a modification of div#text_to_be_changed’s html.

    <script>
    $(document).ready(function(){
        $('#select_days').change(function() {
            $('#text_to_be_changed').html($(this).val());
        });
    });
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: <%= select_tag :role, options_for_select(Project::COMPANY_ROLES.concat(['Other...']), @relationship.role) %> For some reason
I have the following select list. <%= select_tag(:editlevel,options_from_collection_for_select(Level.all, :id, :name)) %> When the user
Hi I have the following to display a dropdown <p><%= f.select :depGroupname, options_for_select(@dep_group_name, :inlcude_blank
I have the following in my view to display a select box with countries
I have the following HTML generated by form_tag and select_tag in Rails: <form accept-charset=UTF-8
I have the following SQL: SELECT * FROM [Database].dbo.[TagsPerItem] INNER JOIN [Database].dbo.[Tag] ON [Tag].Id
I have following select results: Select t1.ID, t1.Value1 from t1 where t1.ID=1 Result: ID
Have the following select giving me the data I want, but I want to
i have the following select box and want to sort it by display:none inlne
I have the following select statement: `Dim rsGetInvoiceContact Dim rsGetInvoiceContact_numRows Set rsGetInvoiceContact = Server.CreateObject(ADODB.Recordset)

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.