From d5dd7297b5937fac7ca46a6814c4bc52e02a415b Mon Sep 17 00:00:00 2001 From: slawkens Date: Sun, 9 Feb 2025 00:03:39 +0100 Subject: [PATCH] Fix deprecation warnings from jquery --- system/templates/admin.menus.js.html.twig | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/system/templates/admin.menus.js.html.twig b/system/templates/admin.menus.js.html.twig index 95bd696c..134d34c3 100644 --- a/system/templates/admin.menus.js.html.twig +++ b/system/templates/admin.menus.js.html.twig @@ -12,28 +12,29 @@ {% endfor %} $(function () { - $(".sortable").sortable(); - $(".sortable").disableSelection(); + const $sortable = $(".sortable"); + $sortable.sortable(); + $sortable.disableSelection(); - $(".remove-button").click(function () { + $(".remove-button").on('click', function () { var id = $(this).attr("id"); $('#list-' + id.replace('remove-button-', '')).remove(); }); - $(".add-button").click(function () { + $(".add-button").on('click', function () { var cat = $(this).attr("id").replace('add-button-', ''); var id = last_id[cat]; last_id[cat]++; const color = colors[cat]; - $('#sortable-' + cat).append('
  • '); //add input bo - $('#remove-button-' + cat + '-' + id).click(function () { + $('#sortable-' + cat).append('
  • '); //add input bo + $('#remove-button-' + cat + '-' + id).on('click', function () { $('#list-' + $(this).attr("id").replace('remove-button-', '')).remove(); }); - initialiceSpectrum(); + initializeSpectrum(); }); - $("#menus-form").submit(function (e) { + $("#menus-form").on('submit', function (e) { $('.blank-checkbox:not(:checked)').each(function (i, obj) { $(obj).parent().prev().val("off"); }); @@ -60,11 +61,11 @@