There is a site in which if you press Enter (anywhere in the DOM) a textbox will appear. If you press Enter again (anywhere in the DOM, could be at the top of the page or could be inside that textbox) a message will be sent.
I'm trying to replicate the physical Enter function with a virtual one, which will happen only when i click a button that I created named 'Enter'.
So basically I wanna replicate the physical Enter function whenever I click the "Enter" button created. With this way I hope the message will be sent.
With the code I provided, the first time I click on the button nothing happens. The second time, it logs in the console "Enter has been pressed". If I have something written in that textbox and I click the button though, the message isn't being sent. I could really use some help here.