Onclick function Call doesn't work in smartphone browser / ipad safari etc

Hello together,
i have to realize a project within several buttons to change multiplikation. So i have make buttons for it an i don’t wont to make the changes with more than one javascript. So my idea was, that i can use the onclick - methode like this:

function selectedYear(hypeDocument, element, event) {

    var cmd18 = document.getElementById('cmd18');
    var cmd20 = document.getElementById('cmd20');
    var cmd25 = document.getElementById('cmd25');
    var cmd30 = document.getElementById('cmd30');
    var cmd35 = document.getElementById('cmd35');
    var cmd40 = document.getElementById('cmd40');
    var cmd43 = document.getElementById('cmd43');
    var cmd45 = document.getElementById('cmd45');
    

    cmd18.onclick = function () { // on click function 
                hypeDocument.functions().SetYear();
    }
    cmd20.onclick = function () { // on click function 
                hypeDocument.functions().SetYear();
    }
    cmd25.onclick = function () { // on click function 
                hypeDocument.functions().SetYear();
    }
    cmd30.onclick = function () { // on click function 
                hypeDocument.functions().SetYear();
    }
    cmd35.onclick = function () { // on click function 
                hypeDocument.functions().SetYear();
    }
    cmd40.onclick = function () { // on click function 
                hypeDocument.functions().SetYear();
    }
    cmd43.onclick = function () { // on click function 
                hypeDocument.functions().SetYear();
    }
    cmd45.onclick = function () { // on click function 

                hypeDocument.functions().SetYear();
    }
    
    
}

This works on desktop browser very good.
But not on a smartphone browser?
What’s the mistake?

just a guess ...

it works, but only on the touch-device.
But all users, who visit the tool with a desktop browser can’t use it know.
if i make 2 function for one button, one with .onclick and one with .ontouchstart it works for both.
But that can’t be the solution :wink:
Is there any combination or other possibility?

I solve it :slight_smile:
Look in to this forum task: if two button are clicked ...

here my short version, which works for me on all devices:

    function selectedCMD()

        var buttonID = element.id;

        if ( buttonID == 'cmd18' ) {
             hypeDocument.functions().SetYear();
        }


        ....


    }

Head is round with it to himself the thoughts can turn :joy: