hello everyone, can somebody please tell me why it does not work…?
I’m trying to display the innerText on a Div element
[https://codepen.io/Alanes/pen/rJJzKv?editors=1111]
@pantera-bo,
what exactly isn’t working?
When I press the buttons, I can see text inside the div.
As a side note, I would not declare currentContent as const since you are changing its innerHTML whenever someone presses a button.
hi @TomerPacific thank you very much for your quick answer!
The Problem was that I was selecting an Array of classes:
like that:
const currentContent = document.getElementsByClassName('content');
And it didn’t work before like that, so i just select that class=“content” and their specific index and now it work perfect!
const currentContent = document.getElementsByClassName('content')[0];
Thank you for your advice, you are right I changed it already