开发者

Click on selected SELECT option, goes to value

开发者 https://www.devze.com 2023-03-05 20:54 出处:网络
I\'m using a SELECT as a main menu. There are several options, fx. \"My Profile\". If I go to \"My Profile\" and continue further down the site tree, the menu is still present and shows \"My Profile\"

I'm using a SELECT as a main menu. There are several options, fx. "My Profile". If I go to "My Profile" and continue further down the site tree, the menu is still present and shows "My Profile" eventhough the accual page is "My Profile > Edit Profile > E-mail settings".

If I开发者_JAVA技巧, on "E-mail settings" or other pages here under, want to go to "My Profile" I cant. Because the option has already been selected.

//DropdownMenu controller
    $('select.dropdownMenu').change(function() {
        //alert('url = ' + this.value );
        window.location.href = this.value;
    });

The above code, only works on change. So I can't select the selected option. I want to.

How can I fix this? jQuery? Do you know?

Thank you in advance.


I found out how.

    //DropdownMenu controller

    $('select.dropdownMenu option').click(function() {
        window.location.href = this.value;
    });
0

精彩评论

暂无评论...
验证码 换一张
取 消