I'm trying to capture the value of an input from a modal once it's opened. I did this, 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 loading. In this case, it loads the previous modal value. What am I doing wrong?