styke
styke

Reputation: 2174

event.preventDefault() not working with jQuery mobile?

Some really simple code:

$(document).on('pagebeforeshow', '#promotional-page', function(){
    $(".win-anchor").on('vmousedown', function(event){
        event.preventDefault();
    });
});

Why does it still redirect to the linked page?

Upvotes: 0

Views: 2474

Answers (1)

Gajotres
Gajotres

Reputation: 57309

Working example: http://jsfiddle.net/Gajotres/y5jyt/

This will work cross platform.

$(document).on('pagebeforeshow', '#promotional-page', function(){       
    $(document).on('vmousedown click', '.win-anchor',function(event){
        event.preventDefault();
        return false;
    });
});

Upvotes: 1

Related Questions