html

Add click event on element AMP

Click event can be assigned on an Element in AMP using on:tap event. It will fire by clicking the Element.

<div id="success-message">Successfully added data</div>

<button on="tap:success-message.hide">Click to hide message</button>

In the code snippet, we have assigned an on:tap event on an element that will fire when click on the element. In the code, we are hiding a message on the button click.

Was this helpful?