$(document).ready(function() {
    if ((navigator.userAgent.match(/iPhone/i))
        || (navigator.userAgent.match(/iPod/i) )
        || (navigator.userAgent.match(/iPad/i))) {
        $("ul#ddm").each(function() { // have to use an `each` here - either a jQuery `each` or a `for(...)` loop
            var onClick; // this will be a function
            var firstClick = function() {
                onClick = secondClick;
                return false;
            };
            var secondClick = function() {
                onClick = firstClick;
                return true;
            };
            onClick = firstClick;
            $(this).click(function() {
                return onClick();
            });
        });
    }
});

