Jump to content

Recommended Posts


The link above is a custom select dropdown. I'm trying to get each item in the dropdown go to a link. I've tried using;


Please select city : 

<select name="select-city" onchange="location = this.value;"> 

<option value="">Select-City</option> 

 <option value="https://en.wikipedia.org/wiki/New_Delhi">New Delhi</option> 

 <option value="https://en.wikipedia.org/wiki/New_York">New York</option> 

 <option value="https://en.wikipedia.org/wiki/Bern">Bern</option> 

 <option value="https://en.wikipedia.org/wiki/Beijing">Beijing</option> 



And this,

<select name="formal" onchange="javascript:handleSelect(this)"> 

<option value="home.com">Home</option> 

<option value="https://www.Facebook.com">Contact</option> 



<script type="text/javascript"> 

function handleSelect(elm) 

window.location = elm.value; 



Link to post
Share on other sites

try this:

<select name="list" id="list" accesskey="target">
    <option value='none' selected>Choose a theme</option>
    <option value="https://en.wikipedia.org/wiki/New_Delhi">New Delhi</option>
    <option value="https://en.wikipedia.org/wiki/Gujarat">Gujarat</option>
    <option value="https://en.wikipedia.org/wiki/New_Delhi">New delhi</option>
<input type=button value="Go" onclick="goToNewPage()" />

and JS file:

 function goToNewPage()
        var url = document.getElementById('list').value;
        if(url != 'none') {
            window.location = url;


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...