Help Wanted on Test Your Skills Event1

MDN Test yours skills page; event1
I am so confused. I have tried doing an event handler with a as a function with an if else statement.
I saved the code in codepen and i hope that I have linked it properly:
chelsea’s codepen with her attempt at solution for EVENT1 on test your skills MDN

Hi @chelsea_rae, and welcome to our community. I’m sorry that you’ve got confused here. You’ll be pleased to know that you are definitely on the right track here.

The main problem here is that you have written a function to handle the button change, but not actually attached it to the button in any way. To do that, you need a line along the lines of btn.onclick = btnChange;.

After that, you need to think about rewriting the if else bits so that the value is toggled between two different values, back and forth.

Our solution is here — Have another go yourself, and then only look at this if you still feel totally stuck.

But you are really close and on the right track. Don’t lose heart!

OMG! I cannot believe that that was what I missed… I needed sleep. Thank you very much. my button works!

@chelsea_rae don’t worry about it; we all make mistakes like this from time to time. It’s part of being a developer.

I am glad you got your button working.