Any way to add a single word attribute to a dom element?

For instance, if I wanted to add the ‘autofocus’ attribute to an ‘input’, the normal html would be:

<input type="text" autofocus>

Is there a way to add such a tag in p5js? The following does not work because ‘.attribute()’ needs 2 arguments to add the attribute.

let input = createInput('');
input.attribute("autofocus");