# Other Languages > jQuery >  [RESOLVED] Select menus nad navigation

## toecutter

Hi,

Venturing into the world of web programming.

i am trying to use a "Select menu" to navagate to a local html page after a selction has been made, i tried searching and came up with nothing.



```
  <label for="select-choice-0" class="select">Select Customer:</label>
  <select name="select-choice-0" id="select-choice-1">
    <option value=""><a href="details.html">bj builders</option>
    <option value="">walkers</option>
    <option value="">hogans building</option>
    <option value="">QLD Electrical</option>
  </select>
```

this is the line i have been trying to get the page link to work in.


```
  <option value=""><a href="details.html">bj builders</option>
```

thx
-toe

----------


## akhileshbc

You have forgot to close the anchor tag.

That line should be like this:


```
<option value=""><a href="details.html">bj builders</a></option>
```

 :wave:

----------


## toecutter

hmm, that does nothing

----------


## akhileshbc

oh! I didn't see that you were using a dropdown box. So, when you select an item, you want to open it's corresponding link. Isn't it ?

Here's a sample piece of code:

HTML:

html Code:
<select name="gotoLinks" id="gotoLinks">
      <option value="http://www.google.com?q=kerala">Kerala</option>
      <option value="http://www.google.com?q=india">India</option>
      <option value="http://www.google.com?q=us">US</option>
      <option value="http://www.google.com?q=canada">Canada</option>
  </select>​
jQuery code:


```
$(document).ready(function(){
    // when the user changes the combobox value
    $('#gotoLinks').change(function(){
      var toURL = $('#gotoLinks :selected').val(); // get the selected items URL
      alert(toURL); // display the selected item's URL

      window.location = toURL; // goto that URL. 
    });
    
});​
```

Here's the fiddle: http://jsfiddle.net/meNYe/

 :wave:

----------


## toecutter

thx, so i need the full url it seems?

----------


## akhileshbc

> thx, so i need the full url it seems?


Full URL needs to be passed to window.location.

If you want to avoid inserting full urls, use a global var that points to your domain:


```
var myDomain = "http://www.google.com/"
```

So, for the window.location, append it with the page selected from the select box:


```
window.location = myDomain + gotoURL; //where gotoURL contains "index.html"
```

 :wave:

----------


## toecutter

excellent,thx

for some reason i am unable to rate you

----------


## akhileshbc

> excellent,thx
> 
> for some reason i am unable to rate you


 :Smilie: 

 :wave:

----------

