I have a website with 2 files (index.php and modals.php).
In index.php I use include("modals.php");
and in modals.php I have several modals that are generated dynamically, according to the information in DB.
In modals.php I have 2 buttons (one created using the <button>Abre</button>
tag and another using the <input type"button" value="Abre" />
tag.
My goal is to use the <button></button>
tag to trigger the event, since I'm using Bootstrap 3 and I want the button to have no text but a glyphicon.
In index.php I have:
<script type="text/javascript">
$( document ).ready(function() {
$(".botaoDoModal").click(function () {
alert("Funciona!");
});
});
</script>
But this script only works when I add class="botaoDoModal"
to the <input>
tag, the same does not happen with the <button></button>
tag.
I do not know why, or if I was wrong and somehow ...