If I wanted to conditionally set which field should have focus using ASP.NET WebForms, I would set Page.Form.DefaultFocus. What is the MVC3 Razor way to do the same?
Background: I have a login page. Sometimes the username field is automatically filled in, sometimes it’s blank. If the username field is blank, I want it to have the focus. If the username field is filled in, I want focus on the password field.
How about using jQuery: