1

i want to create a dropdown menu combine input inside as my image ,i use bootstrap

<i>
 <div class="btn-group dropdown" dropdown >
          <button type="button" class="btn btn-default" dropdown-toggle>
            Dropdown
            <span class="caret"></span>
          </button>
          <ul class="dropdown-menu" id="buttonuser"  role="menu">
            <li>
                <p>Add to</p>
                <input type="text" id="findUser" class="form-control">
            </li>
            <li><a href>Dropdown link</a></li>
            <li><a href>Dropdown link</a></li>
            <li><a href>Dropdown link</a></li>
            <li>Remove</li>
          </ul>
        </div>
</i>

but when i click on input , menu dropdown hide all , i dont want this , please tell me how i do

user3356288
  • 37
  • 1
  • 3

5 Answers5

0

Try to put this script before the end of body or where you have your JS

<script type="text/javascript">
    $('.dropdown-menu input, .dropdown-menu label').click(function(e) {
        e.stopPropagation();
    });
</script>
Eugene Glova
  • 1,543
  • 1
  • 9
  • 12
0
<script type="text/javascript">
 $('#findUser').click(function(e) {
        e.stopPropagation();
    });
</script> 
Ashot Khanamiryan
  • 1,102
  • 12
  • 19
0

Official documentation should help you

bklups
  • 300
  • 1
  • 13
0

Just add this:

$('.dropdown-menu li').click(function(e) {
    e.stopPropagation();
});
Stephan Stanisic
  • 815
  • 7
  • 15
0

If you are using bootstrap 3.3.5 this works by default.