Click here to Skip to main content
15,566,615 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am working on updating an ASP core 2.0 razor page, but cannot set the focus to an input element. I have tried razor, ASP, and HTML, but not seem to work. Hopefully, someone can point me in the right direction. I have two inputs on a partial form so I need to set focus on the first input when the form is created and after the input has changed I need to change the focus to the second input.



Thank you in Advance

What I have tried:

I have tried many many variations of HTML, Razor, and java code, which not have worked.
Posted
Updated 28-Nov-22 0:40am

1 solution

Sounds like you're looking for the autofocus attribute:
autofocus - HTML: HyperText Markup Language | MDN[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900