Monday, 25 March 2019

How to expand/collapse accordion tab when clicking a button?

I have this accordion, so in order to expand/collapse an accordion tab I click anywhere on the tab, but I want to be able to expand/collapse when clicking ONLY on the "Click me" button and not on the accordion tab. Can anyone point me in the right direction? Thanks a lot in advance!

Here's my code:

LIVE DEMO

<p-accordionTab header="Accordion Tab 1" [selected]="true">
   <p-header>
      Accordion Tab 1
      <span>
         <button (click)="myFunction($event)">Click me</button>
      </span>
  </p-header>
   <ul>
     <li>Colors</li>
   </ul>
</p-accordionTab>



from How to expand/collapse accordion tab when clicking a button?

No comments:

Post a Comment