'On click event doesn't work on mobile devices for dynamically build elements with JavaScript

This is how I build DOM:

var projectOverlay = document.createElement("div");
projectOverlay.className = "projectOverlay";
projectOverlay.onclick = function(){openSlider($(this))};   
project.appendChild(projectOverlay);

The openslider(elem) function works perfectly fine in all browsers except on mobile devices (Android phones, iPhone, iPad etc...) . Is there any other way to bind events to the yet created element or I am doing something wrong here?

Necessarily have a look at this link before writing your answers... js/jquery speed test



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source