Search code snippets, questions, articles...

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.

Search Index Data (The code snippet can also be found with below search text)

On tap AMP
Was this helpful?