1

This form dropdown (using Angular UI) isn't working as intended. When clicking on inputs the dropdown disappears. Does anyone have a fix? Thanks!

<ul class="nav navbar-nav navbar-right pull-right">
                        <li class="dropdown" dropdown id="menuLogin">
                            <a href="#" class="dropdown-toggle" dropdown-toggle id="navLogin">Login</a>
                            <div class="dropdown-menu">
                                <form class="form form-group" id="formLogin" _lpchecked="1"> 
                                    <input name="username" id="username" type="text" class="form-control" placeholder="Username"> 
                                    <input name="password" id="password" type="password" class="form-control" placeholder="Password">
                                    <button type="button" id="btnLogin" class="btn btn-default">Login</button>
                                </form>
                            </div>
                        </li>
                        <!-- <li><a href="#">Log in</a></li> -->
                        <li><a href="#" class="cart" ui-sref="basket"><span class="glyphicon glyphicon-shopping-cart"></span><ngcart-badge></ngcart-badge></a></li>
                        <li><a href="#" class="search"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></a></li>
                    </ul>

1 Answer 1

1

You can prevent the toggle by adding

ng-click="$event.stopPropagation()"

to your div:

<div class="dropdown-menu" ng-click="$event.stopPropagation()">
                            <form class="form form-group" id="formLogin" _lpchecked="1"> 
                                <input name="username" id="username" type="text" class="form-control" placeholder="Username"> 
                                <input name="password" id="password" type="password" class="form-control" placeholder="Password">
                                <button type="button" id="btnLogin" class="btn btn-default">Login</button>
                            </form>
                        </div>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.