2
I am trying to capture the value of a modal input as soon as it is opened. I did it as follows, but it did not work:
$('#modal').on('show.bs.modal', function (e) {
var var_tipo = $("#campo_tipo").val();
//testando variavel
alert(var_tipo);
});
I used an Alert to check if the variable is being loaded. In this case, it loads the value of the previous modal. What I am doing wrong?
How many
#campo_tipo
you have in your HTML?– ShutUpMagda
I was reading about the Bootstrap modal. Already tried to change the "show.bs.modal" to "Shown.bs.modal" ?
– Ricardo
There’s only one #campo_type
– Luis
Really, Ricardo! It worked out the way you suggested.
– Luis
@Luis marks the answer to close the post as solved.
– Ricardo