Links in <select> dropdown options

link html
links definition
html link> tag
how to link something in html
a link css
html link color
stylish links in html
all links in one place

Is it possible for each dropdown options to link somewhere when selected without the need for an external button?

<select>
  <option value="x">x</option>
  <option value="y">y</option>
</select>

You can use the onChange property. Something like:

<select onChange="window.location.href=this.value">
    <option value="www.google.com">A</option>
    <option value="www.aol.com">B</option>
</select>

HTML Links Hyperlinks, A link can be an image or any other HTML element! HTML Links - Syntax. The HTML <a> tag defines a hyperlink. It has the following syntax:. LinkedIn began in co-founder Reid Hoffman's living room in 2002 and was officially launched on May 5, 2003. Today, LinkedIn leads a diversified business with revenues from membership subscriptions,

Add an onchange event handler and set the pages location to the value

<select id="foo">
    <option value="">Pick a site</option>
    <option value="http://www.google.com">x</option>
    <option value="http://www.yahoo.com">y</option>
</select>

<script>
    document.getElementById("foo").onchange = function() {
        if (this.selectedIndex!==0) {
            window.location.href = this.value;
        }        
    };
</script>

CSS Styling Links, In addition, links can be styled differently depending on what state they are in. The four links states are: a:link - a normal, unvisited link; a:visited - a link the user � The Links, Incorporated is an international, non-for-profit corporation, established in 1946. It is one of the nation’s oldest and largest volunteer service organizations.

... or if you want / need to keep your option 'value' as it was, just add a new attribute:

<select id="my_selection">
<option value="x" href="/link/to/somewhere">value 1</option>
<option value="y" href="/link/to/somewhere/else">value 2</option>
</select>

<script>
document.getElementById('my_selection').onchange = function() {
    window.location.href = this.children[this.selectedIndex].getAttribute('href');
}
</script>

link in, link in meaning, definition, what is link in: to connect with another idea, statement, : Learn more. "Links" is ultimately derived from the Old English word hlincas (the plural of hlinc, meaning "ridge"). Recorded evidence of "hlinces" (a variant of "hlincas") goes back as far as 931, but "links" began appearing in English only in the 15th century.

Maybe this will help:

<select onchange="location = this.value;">
 <option value="home.html">Home</option>
 <option value="contact.html">Contact</option>
 <option value="about.html">About</option>
</select>

8 Ways to Share Links on Instagram : Social Media Examiner, Think of this as your “home” link. While there are other ways to share clickable links (which we'll discuss in a moment), those routes are targeted� A links is the oldest style of golf course, first developed in Scotland. The word "links" comes via the Scots language from the Old English word hlinc: "rising ground, ridge" and refers to an area of coastal sand dunes and sometimes to open parkland.

This is an old question, I know but for 2019 peeps:

Like above if you just want to change the URL you can do this:

<select onChange="window.location.href=this.value">
    <option value="www.google.com">A</option>
    <option value="www.aol.com">B</option>
</select>

But if you want it to act like an a tag and so you can do "./page", "#bottom" or "?a=567" use window.location.replace()

<select onChange="window.location.redirect(this.value)">
    <option value="..">back</option>
    <option value="./list">list</option>
    <option value="#bottom">bottom</option>
</select>

PS. Sorry if the formatting is weird I'm new at Stack Overflows syntax

Hyperlink, In computing, a hyperlink, or simply a link, is a reference to data that the user can follow by clicking or tapping. A hyperlink points to a whole document or to a� The Hill | 28,587 followers on LinkedIn | The Hill is the premier source for policy and political coverage, reporting on every aspect of the business of Washington and the campaign trail. The Hill

Links in your Content - YouTube Help, Links that send users to websites featuring content that violates our Community Guidelines are not allowed on YouTube. If you find content that violates this� WELCOME. The Washington (DC) Chapter of The Links, Incorporated, chartered in April 1948, is the oldest chapter in the District of Columbia, Maryland, Virginia (DMV) area.

View Junaid Ahmed’s profile on LinkedIn, the world's largest professional community. Junaid has 1 job listed on their profile. See the complete profile on LinkedIn and discover Junaid’s connections and jobs at similar companies.

A basic web application platform which provides weather information of a city the user searches for. It has different search options and handles errors if the city doesn’t exist. The application

Comments
  • This is certainly easy to do. Have you done any research into how you might do this?
  • yes but you need javascript to do it. I'll make you a fiddle. Stay tuned!
  • Like this jsfiddle.net/j08691/X8WUG ?
  • possible duplicate of using href links inside <option> tag
  • Duplicate of stackoverflow.com/questions/2000656/…
  • indeed it is onChange; onValueChanged is not javascript
  • Why is this downvoted? Is it too hard to change URL for desired address?