From 3e2fb1ce24dc297d4417cbb280a6d3fff388895c 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 Signed-off-by: Jonathan Druart Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 0d19d7bcc50d48aa326a909b221a1251f664d632) Signed-off-by: Lucas Gass --- .../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 df4ce94cef..98755dd5a8 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js +++ b/koha-tmpl/intranet-tmpl/prog/js/subscription-add.js @@ -739,20 +739,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("") }); });