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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:54:29+00:00 2026-06-17T22:54:29+00:00

I have first a with 3 option value in it. When I select one

  • 0

I have first a with 3 option value in it. When I select one of the values, I want it to remember which one I picked and once I press my button the javascript will open a specific url.

Some code sample.

       <select id="dd-files">
        <option value="asdf">Pick:</option>
        <option value="url1">File1</option>
        <option value="url2">File2</option>
        <option value="url3">File3</option>
       </select>
      </section>
    </div>
<br>
        <div class="modal-footer">
            <a class="btn btn-primary get-data" href="#">Button</a>
        </div>

javascript This javascript directily just to know how it all works, so I just tested it.

$(".get-data").on("click",function() {
  var location = 'http://hardcodedurl.com';
  window.open(location);

Then I have another function, which when I pick one option value, stores it and open it directly, but instead of open it directly, I would like my second script just to open when my button “.get-data” is pressed.

$(function () {
  $('#dd-files').on('change', function() {
    debugger;
    var url = $(this).val();
    if (url) {
      window.location = url;
    }
    return false;
  })
})

Any advice for a newbie?

  • 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-17T22:54:30+00:00Added an answer on June 17, 2026 at 10:54 pm

    Not clear why do you need on('change') event. To make it open when button is pressed, you just need something like this:

    $(".get-data").on("click",function() {
      var location = $('#dd-files').val(); 
      if(location) {
         window.open(location);
      }
    }
    

    Just take an url from #dd-files directly.

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

Sidebar

Related Questions

I have three depending selects. First one, have some values. <select id=first> <option value=1>v1</option>
Suppose I have a dropdown (select tag) with 3 values. Our first option has
I have multiple selects: <select id=one> <option value=1>one</option> <option value=2>two</option> <option value=3>three</option> </select> <select
I have some code that first selects an option value in a dropdown menu
I have first: select url from urls where site = '$value' order by url
I have two dropdowns. When a user selects a value from the first one
I have two simple select lists and want to add an option to swap
I have two drop downs, one which influences the other. The first acts as
<select id=townid name=townid> <s:iterator value=townsForLanding> <option value=<s:property value=id/>><s:property value=name/></option> </s:iterator> </select> I have a
I have the following: <dd> <select id=contactLocation name=contactLocation size=1> <option value=Online<cfif attributes.contactLocation eq Online>selected</cfif>>Online</option>

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.