bootstrap panel with button - collapse issue

Wojciech Górniak

Here is my code:

<div class="panel panel-default">
    <div class="panel-heading clearfix" role="tab" id="heading-details" data-toggle="collapse" data-target="#details" data-parent="#panel-group" href="#details">
       <h4 class="panel-title pull-left">My panel title</h4>

       <a class="btn btn-primary btn-sm pull-right" asp-action="Action">
            <span class="glyphicon glyphicon-pencil"></span>
        </a>
    </div>
    <div id="details" class="panel-collapse collapse" role="tabpanel">
        <div class="panel-body">
            @Html.Partial("_DetailsPartial", Model)                
        </div>
    </div>
</div>

Issue:

When I click on a button link then panel body expands/collapses. I don't want to toggle panel body when clicking on button.

How can I turn off data-toggle on the button?

Thanks in advance

Wojciech Górniak

Here is what I've done:

  • Added class "disable-collapse" to the button
  • Added script below

$('.disable-collapse').click(function (e) 
{ event.stopPropagation(); })

With this, panel body toggles when I click on the panel header but not when i click on the button.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Bootstrap Collapse: Only one panel at a time (possible jQuery library issue)

Add separate button action for Bootstrap 3 collapse panel

Multiple bootstrap collapse panel opens at one button click

BootStrap Navbar Collapse issue

Bootstrap collapse with dropdown issue

Bootstrap collapse panel closed by default

Bootstrap collapsible panel to not collapse on another panel opening

Bootstrap collapse on radio button

button collapse to the right in Bootstrap

Collapsible panel + button issue

Bootstrap panel collapse incorrect icons with collabsible panel in another collapsible panel

Bootstrap 4 Navbar Collapse Issue

jquery to angularjs: collapse panel and change button image

Bootstrap buttons collapse inside the panel header

how to change collapse direction of a panel in bootstrap

Jquery for loop generated bootstrap panel collapse not working

Bootstrap 4 collapse panel with preview and overflow expansion

Bootstrap 3 collapse - make to collapse only one panel

Bootstrap 3 Collapse - changing the glyphicon in the panel heading depending on collapse state

Bootstrap 4 collapse button is not visible

How to access react-bootstrap panel collapse state in panel title?

Toggle button collapse not working in Bootstrap navbar in bootstrap

Issue regarding bootstrap collapse and it's effect on DOM

Bootstrap Collapse Issue While clicking on other link

issue styling bootstrap navbar when collapse

Django + Bootstrap + Collapse + Item.PK = Issue

Bootstrap Button Hover issue

Issue with Bootstrap burger button

Bootstrap4 navbar collapse button not responding