开发者

iPhone Jquery run function on confirm = true

开发者 https://www.devze.com 2023-04-13 06:13 出处:网络
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...

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号