From f492acca9472500fab2d702916e0585f0b4b4d1e Mon Sep 17 00:00:00 2001 From: Hugh Messenger Date: Tue, 19 Dec 2017 17:37:40 -0600 Subject: [PATCH] Use label's 'for' attribute rather than prev() when building t3onoff --- source/plg_system_t3/base-bs3/js/frontend-edit.js | 2 +- source/plg_system_t3/base/js/frontend-edit.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/plg_system_t3/base-bs3/js/frontend-edit.js b/source/plg_system_t3/base-bs3/js/frontend-edit.js index 08e8c03f3c..410559cc7b 100644 --- a/source/plg_system_t3/base-bs3/js/frontend-edit.js +++ b/source/plg_system_t3/base-bs3/js/frontend-edit.js @@ -24,7 +24,7 @@ //add class on/off $('fieldset.t3onoff').find('label').addClass(function(){ - var $this = $(this), $input = $this.prev('input'), + var $this = $(this), $input = $('#' + $this.attr('for')), cls = $this.hasClass('off') || $input.val() == '0' ? 'off' : 'on'; cls += $input.prop('checked') ? ' active' : ''; return cls; diff --git a/source/plg_system_t3/base/js/frontend-edit.js b/source/plg_system_t3/base/js/frontend-edit.js index e8e3871351..99e6c50929 100644 --- a/source/plg_system_t3/base/js/frontend-edit.js +++ b/source/plg_system_t3/base/js/frontend-edit.js @@ -24,7 +24,7 @@ //add class on/off $('fieldset.t3onoff').find('label').addClass(function(){ - var $this = $(this), $input = $this.prev('input'), + var $this = $(this), $input = $('#' + $this.attr('for')), cls = $this.hasClass('off') || $input.val() == '0' ? 'off' : 'on'; cls += $input.prop('checked') ? ' active' : ''; return cls;