I'm using the owl-carousel 2.0.0 plugin, to make a carousel of product packaging images that are selectable, via an input radio, only one carton should be selected, the structure of this carousel is as follows, container is a <label>
and inside it has the input[type=radio]
and the product image <img>
when clicking the carousel item, which in this case is the label, it changes the state of the input radio to checked, I want to get this event and add a class to the label whenever this radio input is checked, and when I select another radio button it removes the class from the other item and adds it to the current one.
I made a small script but currently it does not do well what I want, when I select another radio it keeps the class in the previous label, maybe it is my logic that is wrong. follow script: