From 0ac5c9f0fd5ec5a1e7b0a3897cd85708a50cc131 Mon Sep 17 00:00:00 2001 From: Dang Quoc Dat Date: Mon, 20 Mar 2017 16:32:29 +0700 Subject: [PATCH] Select the checked options on radio button group. Select checked options on radion button group at front-end editing module. --- source/plg_system_t3/base-bs3/js/frontend-edit.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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 e8e3871351..08e8c03f3c 100644 --- a/source/plg_system_t3/base-bs3/js/frontend-edit.js +++ b/source/plg_system_t3/base-bs3/js/frontend-edit.js @@ -41,7 +41,18 @@ input.prop('checked', true).trigger('change'); } }); + + $(".btn-group input[checked=checked]").each(function() + { + if ($(this).val() == '') { + $("label[for=" + $(this).attr('id') + "]").addClass('active btn-primary'); + } else if ($(this).val() == 0) { + $("label[for=" + $(this).attr('id') + "]").addClass('active btn-danger'); + } else { + $("label[for=" + $(this).attr('id') + "]").addClass('active btn-success'); + } + }); }); -}(jQuery); \ No newline at end of file +}(jQuery);