# Make dropdown clickable and link to different page

**URL:** <https://forum.wixstudio.com/t/make-dropdown-clickable-and-link-to-different-page/38591>\
**Category:** Ask the community\
**Tags:** code, question\
**Created:** [July 13, 2022, 2:10pm UTC](https://forum.wixstudio.com/t/make-dropdown-clickable-and-link-to-different-page/38591 "2022-07-13T14:10:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rebecca-richardson](https://avatars.discourse-cdn.com/v4/letter/r/ec9cab/32.png) [@rebecca-richardson](https://forum.wixstudio.com/u/rebecca-richardson)\
**Post date:** [July 13, 2022, 2:10pm UTC](https://forum.wixstudio.com/t/make-dropdown-clickable-and-link-to-different-page/38591/1 "2022-07-13T14:10:07Z")

</div>

Hello! I am trying to make it so each option on my dropdown menu links to a different page but I have not had much luck so far and can’t work out what I am doing wrong!

I currently have this code in place:

```javascript
import wixLocation from 'wix-location';

export function dropdown1_click(event) {
    let url = $w('#dropdown1');
    console.log(url)
    wixLocation.to("/create2");
}

```

Which sends me straight to the page but I don’t get a chance to quick any option, that happens when I press the dropdown bar to select an option.

Is there any way to make it so that doesn’t happen and I get to actually choose an option?

And then be able to set it up so that the 5 options I have all go to different pages instead of just the one option?

I have linked it to a dataset and just set the values to 1, 2, 3, 4 and 5 and with the title being the actual words I want showing on the dropdown list.

Any help is appreciated! I have been stuck on this for longer than I would like to admit!

---

<div class="post-metadata">

**Author:** ![amotor](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@amotor](https://forum.wixstudio.com/u/amotor)\
**Post date:** [July 14, 2022, 5:30pm UTC](https://forum.wixstudio.com/t/make-dropdown-clickable-and-link-to-different-page/38591/2 "2022-07-14T17:30:20Z")

</div>

If you want to navigate to a url dynamically you need to access the .value property of the dropdown element. Try the following:

```javascript
$w("#dropdown1").onChange((e) => {
    wixLocation.to(e.target.value)
}

```

I am assuming that the url for the page you want to navigate to is stored on the value property of the dropdown (I.E. if you want to navigate to [www.yoururl.com/contact](http://www.yoururl.com/contact) the value stored would just be contact)

If you want to navigate to a dynamic page then you just need to change the wixLocation to the following:

```javascript
wixLocation.to(`prefix/${e.target.value}`)

```

Introduction - Velo API Reference - [Wix.com](http://Wix.com)  
value - Velo API Reference - [Wix.com](http://Wix.com)

---

<div class="post-metadata">

**Author:** ![CODE-NINJA](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/code-ninja/32/110588_2.png) [@CODE-NINJA](https://forum.wixstudio.com/u/CODE-NINJA)\
**Post date:** [July 14, 2022, 5:48pm UTC](https://forum.wixstudio.com/t/make-dropdown-clickable-and-link-to-different-page/38591/3 "2022-07-14T17:48:25Z")

</div>

```javascript
import wixLocation from 'wix-location';

let myUrl=[];
    myUrl[0]="https://www.google.com";
    myUrl[1]="https://www.wix.com/velo/forum";

$w.onReady(()=> {
    let options =[
        {label: "Google.com", value: myUrl[0]},
        {label: "Velo-Forum", value: myUrl[1]},
    ]

    $w('#dropdown1').options = options;

    $w('#dropdown1').onChange((event)=>{
        wixLocation.to($w('#dropdown1').value);
    });    
});

```

---

<div class="post-metadata">

**Author:** ![rebecca-richardson](https://avatars.discourse-cdn.com/v4/letter/r/ec9cab/32.png) [@rebecca-richardson](https://forum.wixstudio.com/u/rebecca-richardson)\
**Post date:** [July 15, 2022, 2:14pm UTC](https://forum.wixstudio.com/t/make-dropdown-clickable-and-link-to-different-page/38591/4 "2022-07-15T14:14:05Z")

</div>

Ahhhhh! Thank you both so much!! This has sorted my problem completely!! 😁
