jquery - Twitter bootstrap collaspe focus on input -
i using twitter bootstrap collaspe function. li elements below , each of tab content consist of input element of class .attrinputs
when click on element of class pill, want input element in each tab focus user dont need click input element. add together jquery using .focus when class of .pill clicked on, possible on sec click not first click.
<ul class="nav nav-pills"> <li> <a class="pill" href="#a" data-toggle="pill"> </a> </li> <li> <a class="pill" href="#b" data-toggle="pill"> b </a> </li> <ul>
my tab content. html same every tab
<div class="span10 offset1 tab-pane active" id="collar"> <div class="span4"> <input class="attrinputs" name="collar" type="text"> </div> <div class="span4 offset1"> <img src="http://placehold.it/300x300/156153"> </div> </div> $('.pill').on('click',function(){ $('.attrinputs').focus(); });
thanks in advance
you can try:
$('.pill').on('click',function(){ settimeout(function() { $('.attrinputs').focus(); },0); });
settimeout()
break chain of click handlers.
for more information, see https://github.com/twitter/bootstrap/issues/2380
jquery twitter-bootstrap
No comments:
Post a Comment