How to focus on ChatGPT prompt text area using JavaScript?

The ChatGPT Web interface has a with id “prompt-textarea”enter image description here in which users input their prompts to get a response. Normally I would drag my cursor to the text area and click on it to focus it, but now I want to do this using (preferably plain) JavaScript.

I have tried document.getElementById("prompt-textarea").focus(); but that returns undefined and doesn’t focus on the text area, I still have to manually drag my cursor and click. To reproduce, visit chatgpt.com, click anywhere on the page to unfocus the text area, go to the console and type document.getElementById("prompt-textarea").focus();, you’ll notice that it will remain unfocused (and return undefined). I’ve observed this behavior on both Firefox and Brave.