How to use the space bar in a dom element

I’m unable to use the space bar in the dom text box in my game. I am using the space bar for the player to shoot. How can I fix this?