From 0d5f437607c3cca050fff3aeef58c8e6c390aaee Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Wed, 15 Feb 2023 10:23:54 +0800 Subject: [PATCH] * Adjust code. --- module/dev/js/langitem.js | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/module/dev/js/langitem.js b/module/dev/js/langitem.js index b6c10ce50c..15e9144419 100644 --- a/module/dev/js/langitem.js +++ b/module/dev/js/langitem.js @@ -1,35 +1,36 @@ $(function() -{ - $(".input-list").on("click", 'input', function(event) +{ + $(".input-list").on("click", 'input', function(event) { addActive(event.target.id); }); - $(".input-list").on("blur", 'input', function(event) + $(".input-list").on("blur", 'input', function(event) { - removeActive(event.target.id); + removeActive(event.target.id); }); + $('.label-list').on('click', '.input-label', function(e) { var clearId = $('.label-list > .text-primary').attr('labelid'); var clickId = $(e.target).attr('labelid'); - if (clearId && clearId != clickId) - { - removeActive(clearId); - } - if (clickId && clickId != clearId) - { + if(clearId && clearId != clickId) removeActive(clearId); + + if(clickId && clickId != clearId) + { addActive(clickId); - $('#' + clickId).focus(); - } + $('#' + clickId).focus(); + } }); + function addActive(id) { $('[labelid=' + id + ']').addClass('text-primary'); $('[iconid=' + id + ']').removeClass('hidden'); - }; + } + function removeActive(id) { $('[labelid=' + id + ']').removeClass('text-primary'); $('[iconid=' + id + ']').addClass('hidden'); - }; + } })