prevent tappable ons-list-item on button click



  • I have taken ons-button in ons-list item I have called PushPage onclick of ons-list-item but I want to stop this event on click of on ons- button which is inside ons-list-item



  • @Gaurav So if I understand you correctly, you want ontap of the list item to pushPage, but the button which is in the list item to do something else, correct?


  • Onsen UI

    @Gaurav You need to stop event propagation for that:

        <ons-list-item onclick="console.log('item')">
          <ons-button onclick="event.stopPropagation(); console.log('button')">
            button
          </ons-button>
        </ons-list-item>
    


  • thanks @Fran-Diox this worked for me


Log in to reply