Skip to content

Commit

Permalink
Fix multiple tooltip issue
Browse files Browse the repository at this point in the history
If there are multiple tooltips, they all report the message "copied" because there is no element selection. This fix resolves the issue.
  • Loading branch information
mauro-miatello authored Feb 25, 2024
1 parent b69364d commit 9475871
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion resources/views/layouts/default.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,13 @@ class="sr-only">love</span> by <a href="https://twitter.com/snipeitapp" rel="noo
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
Expand Down

0 comments on commit 9475871

Please sign in to comment.