I am mounting a mobile application using asp.net (aspx) and modal bootstrap. The purpose of this modal is to fill a label with the information contained in the "date-tagging" attribute of href that triggers this mode. When the modal is triggered on the 1st attempt the label is not being filled. The label is being populated only in the 2nd attempt to open the modal after the "Yes" myButton has been clicked on the 1st attempt.
//acionamento
<a href="#" data-toggle="modal" data-target="#myModal" data-marcacao="frase qualquer">
//modal
<div class="modal fade" id="myModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
</div>
<div class="modal-body">
<asp:Label ID="lblModalMarcacao" runat="server"></asp:Label>
</div>
<div class="modal-footer">
<button class="btn btn-success btn-md" id="myButton">Sim</button>
<button class="btn btn-danger btn-md" data-dismiss="modal">Não</button>
</div>
</div>
</div>
</div>
//script
<script type="text/javascript">
$('#myModal').modal({ backdrop: 'static', keyboard: false });
$('#myModal').modal('toggle');
$('#myModal').modal('handleUpdate');
$(document).ready(function () {
$("a").on("click", function (e) {
e.preventDefault();
$('#lblModalMarcacao').text('Marcação: ' + $(this).attr("data-marcacao"));
});
});
};
</script>