Abrir popup ao clicar em um botão
Olá, tudo bem?
Eu preciso abrir uma popup quando clicar em um botão, o botão seria o da primeira pricing table, esta "Teste Grátis" que tem nesse link aqui: https://goo.gl/5k1qN5 porém não tem como eu colocar um ID nele e detalhe os botões das outras pricing tables tem exatamente as mesmas classes que ele.
Eu já tenho a modal criada e também o código para abrir, mas não estou sabendo como posso pegar esse elemento em especifico. O código para abrir a minha modal é este aqui:
<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 on 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>
Como eu poderia fazer?
Discussão (1)
Carregando comentários...