OnFocusLost下拉隐藏

时间:2014-02-28 00:15:43

标签: jquery css html5 twitter-bootstrap drop-down-menu

我正在使用bootstrap,我尝试将文本字段放在下拉菜单上下文中,但是当我单击字段时,我的下拉列表会隐藏。

如何点击文字字段而不关闭我的下拉列表?

                <ul class="nav navbar-nav navbar-right">
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Entrar <b class="caret"></b></a>
                        <ul class="dropdown-menu">
                            <li>
                                <div class="form-group">
                                    <input type="text" class="form-control" placeholder="Usuario">
                                    <input type="text" class="form-control" placeholder="Senha">
                                </div>
                                <button type="submit" class="btn btn-primary">Entrar</button>

                            </li>

                            <li><a href="#">Meu Perfil</a></li>
                            <li><a href="#">Meus Serviços - Minhas contratações</a></li>
                            <li class="divider"></li>
                            <li><a href="#">Sair</a></li>
                        </ul>
                    </li>
                </ul>

谢谢!

1 个答案:

答案 0 :(得分:0)

试试..

$('.dropdown-menu  input').click(function(e) {
  e.stopPropagation();
});