amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

How to call one Javascript function on different places in one amp HTML document using ID or Class?

Open danyal1248 opened this issue 5 years ago • 3 comments

Call add to cart to perform action on this id

I want to append result in this amp script container or add any div in this container but script will remain same addToCart

Note : Conclusion is that I want to execute one function and parse id in this and show result on another div or something in replace

danyal1248 avatar Feb 08 '21 13:02 danyal1248

@morsssss This looks like a question about how you could execute something with AMP Script. Could you take a look and see if we have adequate answers in our documentation?

kristoferbaxter avatar Feb 08 '21 15:02 kristoferbaxter

Hey @danyal1248 ! I can't entirely tell what you're trying to do from the partial code you provide. It does look like you want to make it so that when a user clicks one DOM element, you set a state variable to false.

If that's it, does this sample help?

If that's not enough, please feel free to ask for more detailed help on Stack Overflow - or to sign up for the AMP Slack channel, where AMP developers discuss questions like this.

morsssss avatar Feb 08 '21 21:02 morsssss

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 12 '22 00:08 stale[bot]