I have a table that receives data from MYSQL, and there is a column in the table that triggers some options when clicked. however Sweetalert2 only works on the first line of records. that is. if by chance there is a record to present and the user clicks the action button, sweetalert2 works normally, but if there is more than 1 record to present, sweetalert2 does not work on the following lines. what did I do wrong?
What I did is the following:
<script>
var ajuda1 = document.getElementById("aceito");
if(ajuda1){ajuda1.addEventListener("click", exibeMensagem_quando_pendente);
function exibeMensagem_quando_pendente(){
Swal.fire({
position: 'center',
icon: 'success',
title: 'Pedido foi aceito',
showConfirmButton: false,
timer: 1500 })}};</script>
<td>
<?php if($row["status"] == "Pendente") : ?>
<a href="javascript:setTimeout(()=>{window.location = '<?php echo $baseurl ?>.editstatusorderfor_accepted.php?&id=<?php echo $row['id']; ?>'},1500);">
<button title="Aceitar" id="aceito" class="button_status_aceito"><i class="icon-like"></i></button></a><?php endif ?>