From a77a8dee3c186a09041558d55ef028860b8a5d43 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 31 May 2022 11:18:08 +0200 Subject: [PATCH] Bug 26377: Simplify JS code Signed-off-by: Owen Leonard --- .../intranet-tmpl/prog/js/subscription-add.js | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js b/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js index 2d7ce39c56..929a1f68d9 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js +++ b/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js @@ -726,20 +726,9 @@ $(document).ready(function() { }); }); - $("#serialsadditems-yes").on("change", function(){ - if( $(this).prop("checked") ){ - $(".use_items").show(); - } else { - $(".use_items").hide().find("select").val(""); - } - }); - - $("#serialsadditems-no").on("change", function(){ - if( $(this).prop("checked") ){ - $(".use_items").hide().find("select").val(""); - } else { - $(".use_items").show(); - } + $("input[name='serialsadditems']").on("change", function(){ + const display = $(this).val() == "1" ? "block" : "none"; + $(".use_items").css('display', display).find("select").val("") }); }); -- 2.30.2