Set Focus to an DOM Input Field

How is it possible to select an input field directly by code, so that you can start typing right away?

I have tried the following commands without success:

input.focus();
input.style(‘focus’, true);
input.style(‘focus’, ‘true’);
input.style(‘focus()’, ‘true’);

https://p5js.org/examples/dom-input-and-button.html

I would be very happy about a clue!

Thanks a lot. And Yes it is a pity that “autofocus()” is pretty much useless when it’s set inside p5.js.