From 27083ea9408d91c81d961b1b4f9419dd62900d15 Mon Sep 17 00:00:00 2001 From: Andreas Goetz Date: Wed, 20 Mar 2013 19:39:05 +0100 Subject: [PATCH] Custom forms checkbox and radio fix --- js/foundation/foundation.forms.js | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/js/foundation/foundation.forms.js b/js/foundation/foundation.forms.js index 43bf4515d..089406b01 100644 --- a/js/foundation/foundation.forms.js +++ b/js/foundation/foundation.forms.js @@ -56,14 +56,9 @@ if ($associatedElement.attr('type') === 'checkbox') { e.preventDefault(); $customCheckbox = $(this).find('span.custom.checkbox'); - //the checkbox might be outside after the label if ($customCheckbox.length == 0) { - $customCheckbox = $(this).next('span.custom.checkbox'); - } - //the checkbox might be outside before the label - if ($customCheckbox.length == 0) { - $customCheckbox = $(this).prev('span.custom.checkbox'); + $customCheckbox = $(this).siblings('span.custom.checkbox').first(); } self.toggle_checkbox($customCheckbox); } else if ($associatedElement.attr('type') === 'radio') { @@ -71,11 +66,7 @@ $customRadio = $(this).find('span.custom.radio'); //the radio might be outside after the label if ($customRadio.length == 0) { - $customRadio = $(this).next('span.custom.radio'); - } - //the radio might be outside before the label - if ($customRadio.length == 0) { - $customRadio = $(this).prev('span.custom.radio'); + $customRadio = $(this).siblings('span.custom.radio').first(); } self.toggle_radio($customRadio); } -- 2.47.3