From 9475871edb1e48d0613c8c509f8f0d0dcc988edc Mon Sep 17 00:00:00 2001 From: MrM <11910225+mauro-miatello@users.noreply.github.com> Date: Sun, 25 Feb 2024 14:48:05 +0100 Subject: [PATCH] Fix multiple tooltip issue If there are multiple tooltips, they all report the message "copied" because there is no element selection. This fix resolves the issue. --- resources/views/layouts/default.blade.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/resources/views/layouts/default.blade.php b/resources/views/layouts/default.blade.php index f355e73d62..95a82ce41f 100644 --- a/resources/views/layouts/default.blade.php +++ b/resources/views/layouts/default.blade.php @@ -960,7 +960,13 @@ var clipboard = new ClipboardJS('.js-copy-link'); clipboard.on('success', function(e) { - $('.js-copy-link').tooltip('hide').attr('data-original-title', '{{ trans('general.copied') }}').tooltip('show'); + // Get the clicked element + var clickedElement = $(e.trigger); + // Get the target element selector from data attribute + var targetSelector = clickedElement.data('data-clipboard-target'); + // Find the target element + var targetEl = $(targetSelector); + clickedElement.tooltip('hide').attr('data-original-title', '{{ trans('general.copied') }}').tooltip('show'); }); // ignore: 'input[type=hidden]' is required here to validate the select2 lists