Skip to content
Advertisement

Django Cannot auto focus on this form but can on forms

I have a login, register and password reset pages both login and register pages auto focus on the username field however on my password reset page auto focus is not working. I have tried widget_tweaks within my template but to no avail like so:

JavaScript

I just cannot get my head around why auto focus works on my other forms but not on password reset. My code is as follows:

View

JavaScript

Template

JavaScript

I even tried the following javascript but again did nothing:

JavaScript

Advertisement

Answer

Just add autofocus attribute to your input field:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement