From: Andreas Goetz Date: Wed, 20 Mar 2013 18:39:05 +0000 (+0100) Subject: Custom forms checkbox and radio fix X-Git-Tag: v4.1.0~28^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F1977%2Fhead;p=thirdparty%2Ffoundation%2Ffoundation-sites.git Custom forms checkbox and radio fix --- 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); }