Chris Muench
Chris Muench

Reputation: 18318

Link Inside Select Box

Is it possible to display an html link inside a multi select box that can be navigated to?

Upvotes: 2

Views: 26199

Answers (3)

ace
ace

Reputation: 6825

You can try to add an onClick event into the option button that will behave like an anchor tag.

<select multiple>
    <option onClick="window.location = 'http://www.google.com'" >google</option>
    <option onClick="window.location = 'http://www.stackoverflow.com'">stackoverflow</option>
</select>

Upvotes: 1

Bala R
Bala R

Reputation: 108957

You could use the value attribute to store the url

<select >

    <option value="www.yahoo.com">yahoo</option>
    ...

</select>

have use javascript to retrieve the value when an item is selected and redirect to that URL.

Upvotes: 6

zzzzBov
zzzzBov

Reputation: 179066

Yes and no.

You cannot make a link inside a select element, however you can make a select element that will change the page when an option is selected. (Probably not what you want)

Additionally, you can make your own pseudo-select box using a combination of input:radio elements, CSS, and JavaScript. This pseudo-select box can be customized to contain anchor elements and other such things if needed.

Upvotes: 1

Related Questions