ampproject / ampproject/amphtml
How to call one Javascript function on different places in one amp HTML document using ID or Class?
- Dominant language
- JavaScript
- Stars
- 14.9k
- Forks
- 4.1k
- PR merge metrics
- No merged PRs in 30d
Description
**Call add to cart to perform action on this id**
add
**I want to append result in this amp script container or add any div in this container but script will remain same addToCart**
let bottomSheetView = document.getElementById("bottomSheetView");
if(bottomSheetView)
{
bottomSheetView.addEventListener("click",createBottomSheet);
}
async function createBottomSheet() {enter code here
let productId = JSON.parse(await AMP.getState('productId.id'));
AMP.setState({bottomSheet:false});
console.log(productId);
}
{
"id" : ""
}
**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**
Contributor guide
Assessment
This issue has not been assessed yet.