soyjavi / QuoJS

Micro #JavaScript Library for Mobile Devices
MIT License
2.07k stars 236 forks source link

preventDefault on tap events #71

Open massimocolella opened 11 years ago

massimocolella commented 11 years ago

hi, trying to understand:

        $$('a.add_fav').on('touchstart', function(e) {
            e.preventDefault();
            mycodehere();
        });

seems to correctly prevent link to be executed, while

        $$('a.add_fav').tap(function(e) {
            e.preventDefault();
            mycodehere();
        });

does take the browser to the a href attribute. tested on safari IOS 6.x, iphone 4. is it right? more in general, which method should be used with quojs to prevent "a" links to be executed? thanks in advance, you did really a great job with quojs.

TNT-RoX commented 11 years ago

e.stopImmediatePropagation();