$(document).on('click', '.span-btn', function(event) {
event.stopImmediatePropagation();
if(event.target.id == null || event.target.id.length < 1) return;
console.log(event.target.id)
});
Click function is not working on iOS device browsers. Tried multiple approaches - touchstart, cursor: pointer and binding to the span. Currently, I have added cursor: pointer in the css for the 'span-btn' class and the above code for handling the click.
Try using touchstart event for iPads and iPhones.
const userAgent = navigator.userAgent;
event = (userAgent.match(/iPad/i) || userAgent.match(/iPhone/)) ? "touchstart" : "click";
and then
$(document).on(event, '.span-btn', (e) => {...});