diff --git a/src/pretix/presale/templates/pretixpresale/event/fragment_addon_choice.html b/src/pretix/presale/templates/pretixpresale/event/fragment_addon_choice.html index e527d8519f..7a91cb8105 100644 --- a/src/pretix/presale/templates/pretixpresale/event/fragment_addon_choice.html +++ b/src/pretix/presale/templates/pretixpresale/event/fragment_addon_choice.html @@ -193,7 +193,7 @@ {% endif %} id="cp_{{ form.pos.pk }}_variation_{{ item.id }}_{{ var.id }}" name="cp_{{ form.pos.pk }}_variation_{{ item.id }}_{{ var.id }}" - data-exclusive-prefix="cp_{{ form.pos.pk }}_variation_{{ item.id }}_" + data-exclusive-prefix="cp_{{ form.pos.pk }}_" aria-label="{% blocktrans with item=item.name var=var %}Add {{ item }}, {{ var }} to cart{% endblocktrans %}"> {% trans "Select" context "checkbox" %} @@ -334,7 +334,7 @@ checked="checked" {% endif %} {% if c.max_count == 1 %} - data-exclusive-prefix="cp_{{ form.pos.pk }}_item_" + data-exclusive-prefix="cp_{{ form.pos.pk }}_" {% endif %} name="cp_{{ form.pos.pk }}_item_{{ item.id }}" id="cp_{{ form.pos.pk }}_item_{{ item.id }}" diff --git a/src/pretix/static/pretixpresale/js/ui/main.js b/src/pretix/static/pretixpresale/js/ui/main.js index 28f9a62a1e..d3db564c9d 100644 --- a/src/pretix/static/pretixpresale/js/ui/main.js +++ b/src/pretix/static/pretixpresale/js/ui/main.js @@ -149,13 +149,11 @@ var form_handlers = function (el) { ).find("canvas").attr("role", "img").attr("aria-label", this.getAttribute("data-desc")); }); - el.find("input[data-exclusive-prefix]").each(function () { - var $others = $("input[name^=" + $(this).attr("data-exclusive-prefix") + "]:not([name=" + $(this).attr("name") + "])"); - $(this).on('click change', function () { - if ($(this).prop('checked')) { - $others.prop('checked', false).trigger('change'); - } - }); + + el.find("fieldset:has(input[data-exclusive-prefix])").on('change', function (e) { + if (e.target.checked) { + $(".input[type=checkbox][name^=" + e.target.getAttribute("data-exclusive-prefix") + "]:checked", this).not(e.target).prop('checked', false).trigger('change'); + } }); el.find("input[name*=question], select[name*=question]").change(questions_toggle_dependent);