# JS event removed after variant selection

**URL:** <https://forum.shopware.com/t/js-event-removed-after-variant-selection/55017>\
**Category:** International (English Only)\
**Tags:** general\
**Created:** [6. September 2018 um 10:15 UTC](https://forum.shopware.com/t/js-event-removed-after-variant-selection/55017 "2018-09-06T10:15:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![roberto](https://avatars.discourse-cdn.com/v4/letter/r/8baadc/32.png) [@roberto](https://forum.shopware.com/u/roberto)\
**Post date:** [6. September 2018 um 10:15 UTC](https://forum.shopware.com/t/js-event-removed-after-variant-selection/55017/1 "2018-09-06T10:15:25Z")

</div>

Hi,

I have created my own script with some functions in it. It is included in my Theme.php file and it’s working fine as long as you don’t select any other variant. When a different variant is selected the pages reloads using ajax and is in this point where the event it’s not assigned to my button again, I understand this is because my script it’s not being executed again. Same happens with a plugin, the JS is loaded the first time but once the page is „refreshed“ stop working

Any ideas?

---

<div class="post-metadata">

**Author:** ![EikeBrandtWarneke](https://avatars.discourse-cdn.com/v4/letter/e/cdc98d/32.png) [@EikeBrandtWarneke](https://forum.shopware.com/u/EikeBrandtWarneke)\
**Post date:** [6. September 2018 um 10:25 UTC](https://forum.shopware.com/t/js-event-removed-after-variant-selection/55017/2 "2018-09-06T10:25:21Z")

</div>

Have a look at this event:&nbsp;[shopware/jquery.ajax-variant.js at 5.4 · shopware/shopware · GitHub](https://github.com/shopware/shopware/blob/5.4/themes/Frontend/Responsive/frontend/_public/src/js/jquery.ajax-variant.js#L150)

Kind regards

---

<div class="post-metadata">

**Author:** ![roberto](https://avatars.discourse-cdn.com/v4/letter/r/8baadc/32.png) [@roberto](https://forum.shopware.com/u/roberto)\
**Post date:** [6. September 2018 um 11:02 UTC](https://forum.shopware.com/t/js-event-removed-after-variant-selection/55017/3 "2018-09-06T11:02:02Z")

</div>

That’s exactly what I needed. Thanks 😃
