Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

JavaScript I think I learned a lesson

KittenKatja

Well-Known Coder
Lesson: Don't insert all the questions into one topic, regardless of how difficult or interesting it looks.

I have been trying to edit classes of elements, but each time, I always get
Code:
Uncaught TypeError: Cannot read properties of undefined (reading 'toggle')
on 'remove', 'delete' and 'toggle'.

W3Schools is in this case not helping at all. (probably even counterproductive to the search of a solution)
 
Lesson: Don't insert all the questions into one topic, regardless of how difficult or interesting it looks.

I have been trying to edit classes of elements, but each time, I always get
Code:
Uncaught TypeError: Cannot read properties of undefined (reading 'toggle')
on 'remove', 'delete' and 'toggle'.

W3Schools is in this case not helping at all. (probably even counterproductive to the search of a solution)
This is because what you are trying to access either a) hasn't loaded in yet, or b) you may be using another identifier.
whenever you get something like this, save the element you are trying to access into a variable, and before you attempt to use any calls on it, log it to console, and inspect the result.
Code:
//if you're using jquery
var myElement = $('#myEl');

//vanila js
var myElement = document.querySelector('#myEl');
var myElement = document.getElementById('myEl');

console.log(myElement);

On a side note: :) there's no issue with you posting multiple questions in a single post lol. Best advice though, is that if you are going to do that, make sure that all questions are related to an extent. That way, it stays on topic, and clean, so that neither you or anyone responding gets confused
 

New Threads

Latest posts

Buy us a coffee!

Back
Top Bottom