开发者

ASP.NET MVC Page - Dropdown control doesn't function with Keyboard Arrow Keys

开发者 https://www.devze.com 2022-12-28 06:48 出处:网络
I have a page that has a Dropdown control (ddlDeliveryMethod). So that when the user selects particular option from the Dropdown(using MOUSE), the respective Div ID\'s are loaded.

I have a page that has a Dropdown control (ddlDeliveryMethod). So that when the user selects particular option from the Dropdown(using MOUSE), the respective Div ID's are loaded.

But instead of Mouse, if we simply use the arrow keys from Keyboard, the respective DIV ID's are not showing.

Is there any workaround for this. Appreciate your responses.

Here is my code:

// based on Delivery method, display the respective fields
        $("#ddlDeliveryMethod").change(function() {
            $('#divRegisteredMail').hide();
            $('#divRegisteredEmail').hide();
            $('#divRegisteredFax').hide();
            $('#divSaveForFuture').hide();
            switch ($("#ddlDeliveryMethod ").val()) {
                case ' -- Select one -- ':
                    break;
                case '开发者_如何学编程Email':
                    $('#divRegisteredEmail').show();
                    break;
                case 'Mail':
                    $('#divRegisteredMail').show();
                    break;
                case 'Fax':
                    $('#divRegisteredFax').show();
                    break;
                default:
                    caption = "default";
                    break;
            }
        });


Bind the keydown event as well as the change...

$("#ddlDeliveryMethod").keydown(function() {
 ...
});
0

精彩评论

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

关注公众号