Does changing HTML via the VEC remove click event bindings? | Community
Skip to main content
jimb0b
New Participant
January 19, 2024
Solved

Does changing HTML via the VEC remove click event bindings?

  • January 19, 2024
  • 1 reply
  • 771 views

Hi Everyone,

 

I have an Angular application and I am running an XT activity on a page that has a section that is 3 cards in a row. Each of these cards is a link to another page. Each of the cards also has a click event binding to run a pre-defined function if/when a user clicks on any of the 3 cards. On the original page (before any personalization is applied) the click event binding works as expected, with the pre-defined function running as it should. However when I use the XT activity to change only the order of the cards and navigate to the page (while activity is live and personalization is applied) when I click one of the cards, the click event binding is no longer firing the pre-defined function.

How can I ensure that, when I use this activity, the click event bindings still work as they should?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by alexbishop

A bit tricky to say but it's possible that the element is being hidden behind other elements when using the Move action - see here for a bit more info around Re-arrange vs Move

1 reply

alexbishop
Employee
January 22, 2024

Not exactly sure how you're making the changes currently but I'd suggest using the "Layout > Rearrange" VEC action if you just need to change the order of the cards, as this should preserve any event handling logic that is attached to the elements

jimb0b
jimb0bAuthor
New Participant
January 25, 2024

This is a great idea. Thank you!

Just a quick side question, I know there is also a 'Layout > Move' VEC action as well, which I believe would achieve the same goal. However when I implement the proper order using the 'Move' action, and activate the activity and go to the activity page to view, the personalization won't show on the page. I can see the changes in the VEC, but not on the activity page when the activity is live. Is there something I could be missing to do in the activity, or could this be a result of missing something in the Launch configuration? Or could it be anything that you may be able to think of?

Thanks again for you response. It's a huge help!

alexbishop
alexbishopAccepted solution
Employee
January 25, 2024

A bit tricky to say but it's possible that the element is being hidden behind other elements when using the Move action - see here for a bit more info around Re-arrange vs Move