ontouchstart instead of onclick

ontouchstart instead of onclick

I'm developing a Web App for the iPhone. I use the index method of jQuery to get the index of the clicked DIV and write it into the local Storage, because I need it later on. Like so:

(function($){
    $(document).ready(function(){
        $("div").click(function() {
            var indexzahl = $("div").index(this);
             localStorage.setItem("divbaer3","div" + indexzahl);
            });
        });
    })(jQuery);

on all of the DIVs there is an onClick event which triggers another function and goes to the next page. But as it seems, onClick always has a delay on the iPhone and therefore I'd like to use onTouchStart instead. But If I replace onClick by onTouchStart in my code, the jQuery function doesn't work anymore. Is there a way to solve this problem? (it only has to work in Safari / on the iPhone.)

Thanks for any hint.
Antonia

(project in its current state with onclick on http://www.fire.ch/ios/orakel1.html )
















    • Topic Participants

    • lutz