jquery - Bootstrap 3 closing dropdown after click problems with IE and Chrome -


i'm trying close via jquery bootstrap 3 drop down after clicking on list item.

html

<div class="btn-group">     <button type="button" data-toggle="dropdown" class="btn btn-default dropdown-toggle">10 <span class="caret"></span></button>     <ul class="dropdown-menu">         <li><a href="javascript: void(0)">10</a></li>         <li><a href="javascript: void(0)">20</a></li>     </ul> </div> 

js

$('.header').on('click', '.dropdown-menu li a', function(e){     e.stoppropagation();     var number = $(this).text(),     $(this).parents(".btn-group").find('.btn').html(number + " <span class=\"caret\"></span>");     $(this).dropdown("toggle"); // use close dropdown on click  }); 

unfortunately solution not work ie , chrome. in fact, after ran few times choice, drop down stops show elements.

with firefox seems work without problems. how can solve problem?

thank you

edit

jsfiddle

i noticed firefox have same problems

for have same problem found trick solve it.

use

$("body").trigger("click"); 

in place of

$(this).dropdown("toggle"); 

Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -