From ba47352a73f4dd3c499c54f7d68e2bca0b1fb879 Mon Sep 17 00:00:00 2001 From: manchandavishal Date: Tue, 9 May 2023 16:19:41 +0530 Subject: [PATCH] Fix deprecated use of 'jQuery.fn.change()' shorthand event This patch changed the code to use the recommended .trigger("change") method instead of the deprecated .change(). For more information about this deprecation, please refer [1]. [1] https://api.jquery.com/change-shorthand/ Change-Id: I762485c979cc5032db9a080d97d74f4be6efbcaf --- horizon/static/horizon/js/horizon.forms.js | 4 ++-- horizon/static/horizon/js/horizon.modals.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/horizon/static/horizon/js/horizon.forms.js b/horizon/static/horizon/js/horizon.forms.js index 27a7e9bd66..832ea439f2 100644 --- a/horizon/static/horizon/js/horizon.forms.js +++ b/horizon/static/horizon/js/horizon.forms.js @@ -279,7 +279,7 @@ horizon.forms.init_themable_select = function ($elem) { // Set the select if necessary if ($select.val() !== value) { - $select.val(value).change(); + $select.val(value).trigger("change"); } }); @@ -318,7 +318,7 @@ horizon.forms.init_themable_select = function ($elem) { } // Add the new list to the dropdown. - $select.siblings('.dropdown-menu').html(list).change(); + $select.siblings('.dropdown-menu').html(list).trigger("change"); $select.trigger('change'); }); diff --git a/horizon/static/horizon/js/horizon.modals.js b/horizon/static/horizon/js/horizon.modals.js index 87e546ca25..629023905e 100644 --- a/horizon/static/horizon/js/horizon.modals.js +++ b/horizon/static/horizon/js/horizon.modals.js @@ -349,7 +349,7 @@ horizon.addInitFunction(horizon.modals.init = function() { json_data = JSON.parse(data); field_to_update = $("#" + add_to_field_header); field_to_update.append(""); - field_to_update.change(); + field_to_update.trigger("change"); field_to_update.val(json_data[0]); } else { horizon.modals.success(data, textStatus, jqXHR);