When using the confirm()
function in JavaScript, it usually looks like this:
var resultado = confirm("Deseja realmente confirmar?");
if(resultado){
//confirmou...
}
I would like to know if there is any way to do the same thing with a function of its own, eg
var resultado = minhaCofirmacao("Deseja realmente confirmar?");
if(resultado){
//...
}
Here's an example of the function (only with the practical parts of the question): FIDDLE
I tried doing this by creating a listener for when the user clicked on the confirmation button of my function, but it returns before the user triggers the event by itself.
Is there any way to create this type of return
dependent on a user action without being callback ?