When I double click on the last line of my html table datad-id=5 the thumbnail appears with the data but it is displayed several times.
On the other hand I have no problem for data-id=4
<table id="tablesForm">
<tr class="classe1" data-id="4">
<td>rouge></td>
<tr>
<tr class="classe1" data-id="5">
<td>orange</td>
</tr>
</table>
$('#tablesForm').on('dblclick', 'tr', function(event) {
var idCard = $(this).attr("data-id");
var mouseX = event.pageX;
var mouseY = event.pageY;
$('#results').remove();
// Afficher idCard en utilisant AJAX
$.ajax({
url: 'data/show_card.php?mode=client',
type: 'get', // ou 'POST' selon votre configuration
data: { id: idCard },
success: function(response) {
var resultElement = $('<div id="results"></div>');
resultElement.html(response)
.css({
"position": "absolute",
"left": mouseX + "px",
"top": mouseY + "px"
})
.appendTo('body');
}
});
event.preventDefault();
event.stopPropagation();
});
$(document).on("click", function(event) {
if (!$(event.target).closest('#results').length) {
$('#results').remove();
}
});