Problem DropDown bootstrap menu

5

I have my dropdown menu

But I always have to give 2 clicks to open the menu, I would like the first click to open it ...

Would it be possible to have it without the element <a ?

this is my code:

 <div class="navbar navbar-default">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
            </div>

            <div class="collapse navbar-collapse js-navbar-collapse">
                <ul class="nav navbar-nav">
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Cadastro <span class="caret"></span></a>
                        <ul class="dropdown-menu" role="menu">
                            <li><a href="#/clientes">Cliente</a></li>
                        </ul>
                    </li>
        </ul>

            </div><!-- /.nav-collapse -->
        </div>
    </div>
    
asked by anonymous 13.08.2014 / 22:04

1 answer

4

There are two ways:

1. Prevent default behavior of dropdown-toggle

Add the following in your code:

$('.dropdown-toggle').click(function(e) {
    e.preventDefault();
    e.stopPropagation();

    return false;
});

2. Using another class

Change% of% by% with%.

    
13.08.2014 / 22:10