Skip to main content
AP_AW
Inspiring
August 7, 2016
Question

Use JavaScript to set onclick event

  • August 7, 2016
  • 1 reply
  • 7754 views

I'm trying to set an onclick event using JavaScript to a Cp smart shape called "item_01".

When I look at the HTML that is generated the shape does indeed have an onclick event attached but Cp "covers" it with at least two other shape-related elements making it impossible for "item_01" to get clicked by the user.

How can I use JavaScript to attach an onclick event to a smart shape that gets triggered by the user clicking the smart shape?

This topic has been closed for replies.

1 reply

TLCMediaDesign
Inspiring
August 8, 2016

Do you have the smartshape "use as button" option selected?

AP_AW
AP_AWAuthor
Inspiring
August 8, 2016

Yes, the smart shape is marked as 'use as button'.

AP_AW
AP_AWAuthor
Inspiring
August 10, 2016

So the interactive item submit is working and that is what you want.


No. While e.Data is showing that "item_1" is being clicked, doing so never triggers

document.getElementById("item_1").addEventListener("click"...