From: Arkadiusz Dzięgiel Date: Thu, 28 Mar 2013 23:33:58 +0000 (+0100) Subject: Handle case when custom checkbox is in other element than label X-Git-Tag: v4.1.0~17^2~5^2^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F2065%2Fhead;p=thirdparty%2Ffoundation%2Ffoundation-sites.git Handle case when custom checkbox is in other element than label --- diff --git a/js/foundation/foundation.forms.js b/js/foundation/foundation.forms.js index 42cafabcb..2d481c9ff 100644 --- a/js/foundation/foundation.forms.js +++ b/js/foundation/foundation.forms.js @@ -66,17 +66,17 @@ if ($associatedElement.attr('type') === 'checkbox') { e.preventDefault(); $customCheckbox = $(this).find('span.custom.checkbox'); - //the checkbox might be outside after the label + //the checkbox might be outside after the label or inside of another element if ($customCheckbox.length == 0) { - $customCheckbox = $(this).siblings('span.custom.checkbox').first(); + $customCheckbox = $associatedElement.add(this).siblings('span.custom.checkbox').first(); } self.toggle_checkbox($customCheckbox); } else if ($associatedElement.attr('type') === 'radio') { e.preventDefault(); $customRadio = $(this).find('span.custom.radio'); - //the radio might be outside after the label + //the radio might be outside after the label or inside of another element if ($customRadio.length == 0) { - $customRadio = $(this).siblings('span.custom.radio').first(); + $customRadio = $associatedElement.add(this).siblings('span.custom.radio').first(); } self.toggle_radio($customRadio); }