2
I wonder if it is possible to create and open a Twitter-Bootstrap alert (.Alert) with a custom message within the script itself, without having to create the custom div outside the script and call it? By clicking the "meuInput" button, create and open Alert with a message with the example below:
<input type='text' name='meuInput' id='meuInput'>
<button id='meuBtn' class='btn btn-default'>Continuar</button>
<script>
$(document).ready(function(){
var meuInput = $("#meuInput").val();
$("#meuBtn").on('click',function(){
if(meuInput == "") {
[ chamar um alerta com a mensagem personalizada dentro do script ]
}
});
});
</script>
Thanks for the tip, it did work, but it’s the use of Alert, not modal, and I would really like the message from Alert, in the case of your example, to be passed straight from a javascript var to div.modal-body.
– ElvisP
@Eliseub pass what value?
– novic
In the example I did, the "myInput" input is checked to be empty, so pass value into Alert, for example "The myInput field is empty". I got here how to do, thanks for the help.
– ElvisP