Bug 26377: Simplify JS code
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 31 May 2022 09:18:08 +0000 (11:18 +0200)
committerTomas Cohen Arazi <tomascohen@theke.io>
Wed, 20 Jul 2022 12:56:24 +0000 (09:56 -0300)
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
koha-tmpl/intranet-tmpl/prog/js/subscription-add.js

index df4ce94..98755dd 100644 (file)
@@ -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("")
     });
 
 });