adding autofocus attribute with js

I'm creating html elements with javascript. I tried to add the attribute autofocus to the input element like this input.autofocus = true, but it didn't work. I can see why it's not working, but is there a way around?
1 Reply
RGthehuman
RGthehumanOP14mo ago
well nevermind. I found the solution. I have to call the function appendChild(input) at the end
Want results from more Discord servers?
Add your server