In Bootstrap 2.3.2, when there is multiple dropdown element and when the key pressed is enter, it is not showing the right dropdown

StackOverflow https://stackoverflow.com/questions/23342118

문제

When I press "ENTER" in the textbox, the dropdown menu that is shown is the first one. It should be the dropdown menu related to the textbox. I'm using Bootstrap 2.3.2.

Is there anyway to fix this behavior?

See the codepen for an example: http://codepen.io/anon/pen/irCsF

This is how I fixed my problem.

    var $this = $(this);

    $this.find('input').bind('keypress', function(event)
    {
       if(event.keyCode == 13)
        {
            if($this.find('.btn-group button.dropdown-toggle').length > 0)
            {
                event.preventDefault();
                $this.find('.btn-group button.dropdown-toggle').click();
            }
        }
    });
도움이 되었습니까?

해결책

the problem is with the button tag when you hit enter button event fire change the button tag to span your problem will be solved

http://codepen.io/anon/pen/Kmnzq

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top