TransWikia.com

bootstrap collapsible div disable

Stack Overflow Asked by kumara on December 11, 2021

i am using collapsible div option to my html table

<table>
  <tr data-toggle="collapse" data-target="#@item.PendingRequest.TicketNumber" class="collapsed>
     <button onclick=" popupload(); "> </button>
  </tr>
  <tr>
     <div class="collapse " id="@item.PendingRequest.TicketNumber ">
            data after collapse
     </div>
       
  </tr>
</table>

when i click table row (tr), content expand and show. its working well. when i click button to load popup, collapsible function working, before load popup. i need to stop collapsible option when button click. how i do it

One Answer

You can do it like this (based on your fiddle in comment):

Add click event on whole .panel-info. Add id to <button id="Popup">

Then listen if button is clicked:

event.target.id==="Popup"

if it is stop events before it:

event.stopPropagation();

Example: https://jsfiddle.net/7qg6pun0/1/

document.querySelector(".panel-info").onclick = function(event) {myFunction()};
    
function myFunction() {
    if (event.target.id==="Popup"){
        event.stopPropagation();
        alert("clicked button");
    }
}

Answered by ikiK on December 11, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP