javascript - Prevent panel collapse on heading child element click -
i have prepared demo here.
i want toggle panel body clicking on panel heading. if there buttons in heading, them not toggle panel body, how can this?
source code:
html
<div class="panel panel-default"> <div class="panel-heading clearfix" data-toggle="collapse" data-target="#body"> <span>text</span> <button class="btn btn-default pull-left">button</button> </div> <div class="panel-body collapse" id="body"> asd </div> </div>
p.s.: apologize if has been asked already, it's hard me form title find problem.
$('.panel-heading .btn').click(function (e) { e.stoppropagation(); });
of course, affect intended function of button well. explain better answer.
Comments
Post a Comment