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(); }); 

demo

of course, affect intended function of button well. explain better answer.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -