Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firefox dropdown menu click

I have a dropdown menu for languages in my website and it works fine in Google Chrome, Safari and Internet Explorer, but it is bugged in Firefox.

This is the code:

<a href="">
    <select id="languageSelector" style="background-color: transparent" onchange="location = this.options[this.selectedIndex].value;">
        <option value=".">ESPAÑOL</option>
        <option value="./en/index.html">ENGLISH</option>
        <option value="./de/index.html">DEUTSCH</option>
        <option value="./fr/index.html">FRANÇAIS</option>
        <option value="./nl/index.html">NEDERLANDS</option>
    </select>
</a>

It also has a rare behaviour. If I move throught the select with my keyboard and I press Enter, it works, but clicking with the mouse is not working.

I'm using Firefox 38.0.5.

Any help would be appreciated.

like image 416
borjacastillo Avatar asked Oct 19 '22 09:10

borjacastillo


1 Answers

Why is your code surrounded by an a-Tag (<a href=""></a>) ? If you click on the content (e.g. your dropdown) the href="" reload the page. Remove the a or change href="" to href="#".

like image 169
Christoph Avatar answered Oct 21 '22 23:10

Christoph