iPhone Jquery run function on confirm = true
I'm using html / jquery to make my phone list, and I want to have a confirm dialog to do the action, but even if I tap cancel, the action is fired...
also, is there any chance of using jquery and cycript together?
Thanks
$(".btns_numeros").click(function() {
confirmacao($(this).attr('id'));
});
//
function confirmacao开发者_如何转开发(numero) {
var resposta = confirm ("Ligar para "+numero+" ?");
if (resposta) {
var ligar = "<a href='tel:"+numero+"'></a>";
window.location.href = ligar;
} else {
event.preventDefault();
return false;
}
}
adding
event.preventDefault();
solves the question
精彩评论