Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript jQuery .on('click') not working on some mobile browsers Reply To: jQuery .on('click') not working on some mobile browsers

#235929
koenigsegg1
Participant

I added this code:

$(".btn").on('mousedown touchstart', function(){
    alert("The btn was clicked.");
 });

… and it triggered an alert. I’m not shure why it can’t do a basic .removeClass.

How do you usually add/remove classes by clicking an element on mobile devices? Am I doing something wrong? Like I said, I’m very new to JS, so I don’t understand a lot of things.