Reputation: 476
I'm trying to log an event object each time an element is clicked (doing this for debugging).
I am using this function:
$(window).on('click', function(e) {
console.log(e);
});
This logs the click event on my desktop bowser; however, this doesn't log anything in the mobile consoles. Do mobile browsers not interpret click events as touch events?
Upvotes: 1
Views: 100
Reputation: 9471
You can capture both clicks and touches using:
$(window).on('click touchstart', function(e) {
console.log(e);
});
Upvotes: 1