From 492f61b7d9b2f7dba037b77031eff3ec81492f68 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Arkadiusz=20Dzi=C4=99giel?= Date: Fri, 29 Mar 2013 00:33:58 +0100 Subject: [PATCH] Handle case when custom checkbox is in other element than label --- js/foundation/foundation.forms.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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); } -- 2.47.3