Span element is null but why? (includes explanation video)

I have a span element which I’m wanting to add text to via JS but it’s not working, and in fact is null in the Firefox Inspector. Any thoughts? Here’s a vid which shows all the working parts:

(I should probably speak more clearly but hopefully it’s understandable)

Here’s a view from the FF inspector but full details in the vid:

Thank you for any help!

You’re removing the span when you replace the innerHTML of the button. So it no longer exists.

Click the button then examine the HTML. You should see it’s gone

1 Like

Indeed. Noob alert. I put the main button text in a span too and it’s working. Thank you very much!

1 Like