Expand my Community achievements bar.

SOLVED

Does changing HTML via the VEC remove click event bindings?

Avatar

Level 2

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?

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

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

View solution in original post

3 Replies

Avatar

Employee Advisor

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

Avatar

Level 2

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!

Avatar

Correct answer by
Employee Advisor

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