ClassList.remove function is not working in my setTimeout function

When the name input and image input blocks are empty, I click on the "add items " button and a red display block with the message “Please Enter Valid Values” below the Items Form title is supposed to appear for about 4 seconds and then disappear. But it remains there after four seconds. Here is the link to my code :

are you guys g etting stuck too

It is removing the showItem class. But you need to uncomment the CSS in .feedback class otherwise nothing will happen when the showItem class gets removed.

1 Like

that resolved my issue

When testing this you can inspect the DOM to see the class getting added and removed in real-time. You should also keep an eye on the Styles panel to see how the CSS is interacting. Sometimes you might have issues with specificity, the cascade (the order), or maybe you just forgot some style like in this case.

Happy coding.