I tried a whole bunch of things from:
onClick not working on mobile (touch)
document .click function for touch device
However nothing seems to work.
Here's what I have:
#modal-close {cursor:pointer;}
<button class="button" id="modal-close">ok</button>
function hideModal(){
var modal = document.getElementById('modal');
modal.style.display = 'none';
}
$(function() {
$('#modal-close').on('click touchstart',function (e) {
hideModal();
})
});
What might I be doing wrong?