1
My modalbox doesn’t run my jquerry script
$(document).ready(function() {
var audioElement = document.createElement('audio');
audioElement.setAttribute('src', '/teste/typewriter-2.mp3');
$('#nome').keydown(function(event){
audioElement.play();
console.log("entrou");
});
$('#email').keydown(function(event){
audioElement.play();
});
$('#telefone').keydown(function(event){
audioElement.play();
});
$('#empresa').keydown(function(event){
audioElement.play();
});
$('#mensagem').keydown(function(event){
audioElement.play();
});
});
modal code
<div style="z-index: 999999;" class="modal fade" id="exampleModal1" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div style="color:black;" class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-body">
<img style="margin-top: 20px; margin-left: 20px;" data-dismiss="modal" width="60" src="/images/close.svg">
<br><br>
<center>
<h3 style="color:black" > ORGANIZAÇÕES </h3>
<br>
</center>
<div style="display:block" class="desktop">
<form class="contacto" name="organizacaoDesktop" id="organizacaoDesktop" action="processa_contato.php" method="post">
<table style="width:90%">
<tr>
<td colspan="5">
<input type="text" name="nome" id="nome" width="100%">
</td>
<td>NOME* <br><br></td>
</tr>
<tr>
<td colspan="2">
<input class="" type="text" name="telefone" id="telefone">
</td>
<td>TELEFONE</td>
<td colspan="2">
<input style="" type="text" name="empresa" id="empresa">
</td>
<td>EMPRESA* <br><br></td>
</tr>
<tr>
<td colspan="5">
<input type="text" name="email" id="email">
</td>
<td>EMAIL*<br><br></td>
</tr>
<tr>
<td colspan="5">
<textarea rows="4" class="notes" id="mensagem" name="mensagem" ></textarea>
</td>
<td style="position: absolute;">Mensagem</td>
</tr>
</table>
<br><br>
<input style="background:white" class="submit"name="enviar-livre" type="submit" value="Enviar" onclick="return validarDesktop()">
<br><br>
<span class="campos" style="font-size:9px;"> *Campos obrigatórios </span>
</form>
</div>
<div style="display:none" class="mobile">
<form class="contacto" id="organizacaoMobile" name="organizacaoMobile" action="processa_contato.php" method="post">
<table style="width:90%">
<tr>
<td colspan="5">
<input type="text" name="nome" id="nome" width="100%">
</td>
<td>NOME* <br><br></td>
</tr>
<tr>
<td colspan="5">
<input type="text" name="email" id="email">
</td>
<td>EMAIL*<br><br></td>
</tr>
<tr>
<td colspan="5">
<input class="" type="text" name="telefone" id="telefone">
</td>
<td>TELEFONE <br> <br> </td>
</tr>
<tr>
<td colspan="5">
<input style="" class="empresa" type="text" name="empresa" id="empresa">
</td>
<td>EMPRESA* <br><br></td>
</tr>
<tr>
<td colspan="5">
<textarea rows="4" class="notes" id="mensagem" name="mensagem" ></textarea>
</td>
<td style="position: absolute;">Mensagem</td>
</tr>
</table>
<br><br>
<input style="background:white" class="submit"name="enviar-livre" type="submit" value="Enviar" onclick="return validarMobile()">
<br><br>
<span class="campos" style="font-size:9px;"> *Campos obrigatórios </span>
</form>
</div>
</div>
</div>
</div>
</div>
You cannot repeat id’s. Exchange them for
class
.– Sam