I have a dropdown menu using Bootstrap and inside it, there is an input field. Everytime I click the input field, the dropdown menu disappears. How would I stop that?
By the way, I'm using AngularJS, so jQuery way probably won't fit in here.
<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown">
<span class="pull-left">{{ trans('text.choose_user') }}</span>
<span class="pull-right"><i class="icon-order-table"></i></span>
</button>
<ul class="dropdown-menu" role="menu">
<li role="presentation" class="basic-padding"><a role="menuitem" tabindex="-1" href="#">{{ trans('text.guest') }}</a></li>
<li class="basic-padding">
<div class="input-group">
<input type="search" class="form-control" placeholder="{{ trans('text.search') }}">
<span class="input-group-btn">
<button class="btn btn-default">
<i class="icon-search"></i>
</button>
</span>
</div>
</li>
</ul>
</div>
Thanks to @Rob J, I've come up with a solution, not exactly as what he mentioned though:
<input type="search" class="form-control" placeholder="{{ trans('text.search') }}" ng-click="$event.stopPropagation()">
You should try using angular ui-select. Here's link to github
Link to plunker demo
Go through the documentation and there are several options to configure ui-select.
Sample code to configure ui-select
<ui-select ng-model="person.selected" theme="bootstrap" style="min-width: 300px;">
<ui-select-match placeholder="Select a person...">{{$select.selected.name}}</ui-select-match>
<ui-select-choices repeat="person in people | propsFilter: {name: $select.search}">
<div ng-bind-html="person.name | highlight: $select.search"></div>
</ui-select-choices>
</ui-select>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With