Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

119
Visualizações
Modal tot pop up from a link

I have the following code

echo "<td class = container_update ><a href = 'ShowAngajati.php?id=$row[ID_Angajati]
                                                                          &nm=$row[Nume]
                                                                          &pr=$row[Prenume]
                                                                          &cn=$row[CNP]
                                                                          &dn=$row[Data_Nasterii]
                                                                          &se=$row[Sex]
                                                                          &nr=$row[Numar_Telefon]
                                                                          &sa=$row[Salariu]
                                                                          ' id='myBtn'>Update</a></td>";


and the script

<script>
// Get the modal
var modal = document.getElementById("myModal");

// Get the button that opens the modal
var btn = document.getElementById("myBtn");

// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];

// When the user clicks the button, open the modal 
btn.onclick = function() {
  modal.style.display = "block";
}

// When the user clicks on <span> (x), close the modal
span.onclick = function() {
  modal.style.display = "none";
}

// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
  if (event.target == modal) {
    modal.style.display = "none";
  }
}
</script>

Thing is I want a modal to pop up when i click on the link ("Update"). It does pop up but only for a second (while the tab is refreshing) and it pops up only when i click on the first row of my table. The conlusion would be: I'd have a big table (for a database) with a "update" button on each row that when i click would pop out a modal with an already completed form (completed with the data already in my database) and just change the thing i want to change (that's why i need the nm, pr, cn and so on variables).

about 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda