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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:29:23+00:00 2026-06-11T07:29:23+00:00

I have a select drop down of items. When the user selects and item

  • 0

I have a select drop down of items. When the user selects and item I need to redirect to edit_item_path for the item_id. e.g. If user selects and item with id =5 I need to redirect to items/5/edit path

How to do this in rails 3 and jquery?

  • 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-11T07:29:25+00:00Added an answer on June 11, 2026 at 7:29 am

    Lets say that your dropdown looks like this:

    <select id="editable_pages">
      <option value="1">Edit 1</option>
      <option value="2">Edit 2</option>
    </select>
    

    in that case following jquery snippet should works:

    $('#editable_pages').change(function() {
        window.location = "items/+ $(this).find(":selected").text() +/edit";
    });
    

    Nicer solution is to use rails route helpers. To do that you could add a html5 data attribute with url to each options, eg:

    <option value="1" data-edit-url="<%= edit_item_url(1) %>">Edit 1</option>
    
    $('#editable_pages').change(function() {
        window.location = $(this).find(":selected").data('edit-url');
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two drop down boxes in my program. When you select an item
i have a form that has a multiple select drop down. a user can
I have capture change event on drop down select. This drop down field is
I have this drop-down list of countries: <select name=country> <option value=>Country...</option> <option value=Afganistan>Afghanistan</option> <option
I have a drop down that filters a multi-select box that then the user
Ok here goes: I have a SELECT drop down option with US state names
We have all seen countless instances of forms with a select drop down having
I have a form with two text boxes, one select drop down and one
I have implenmented drop-down lists Select menus in jQuery Mobile. <div data-role=fieldcontain> <label for=name
I have a drop down list where users can select a theme for the

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.