on-internet
← Community

Why does my code throw a "Cannot read property 'classList' of undefined" Error?

Stack Overflow ·

I was working on a personal project of making a slider using pure JavaScript, but when I click the Next or Previous buttons, the console shows an error that the property 'classList' of undefined: Uncaught TypeError: Cannot read property 'classList' of null at prev (main.js:36) at HTMLElement.<anonymous> var next1 = document.getElementById("next"); var prev1 = document.getElementById("prev"); var ulist = document.getElementsByTagName("ul").lastChild; var ulist1 = document.getElementsByTagName("ul").firstChild; var slides = document.querySelectorAll("li"); var active = document.getElementsByClas

Comments

Sign in or sign up to comment and upvote.

No comments yet.