1 year ago
#386969
TLausie
Javascript Display block when a button is clicked doesn't work on mobile
I have this function that checks whether something inside a certain div is clicked. A part of the function checks if the targeted button has a certain class. This works perfectly, but when I go to mobile it doesn't work like I want it to.
btn.addEventListener("click", function (event) {
if (!tgt.className.indexOf('nextbtn')) {
navi.NextBtn();
let dots = document.getElementsByClassName('owl-dots')[0];
dots.style.display = 'block';
}
})
I did a ! in the if statement because somehow it is reversed (I don't know why). If I remove it it won't do anything. On my computer it works perfectly, but when I go to mobile it doesn't change the style to block, but it does run the NextBtn function. Does anybody know how to fix it?
javascript
dom
click
addeventlistener
0 Answers
Your Answer