I have various pages where I have implemented the focus method on the first text field (tried $w.onReady as well as the text field viewportEnter events). When loading these pages first time it works, but whenever the pages load via a link from another page, the field loses focus after a second or so. Does anyone have a fix for this?
Here is a very simple example to demonstrate the issue. If you go to
You will see that Field 1 is correctly given focus when the page loads:
Now go to https://astutesystems.wixsite.com/testsite and click on the 'Register' button which is a simple link to the first page. It focuses correctly for about a second and then loses focus... highlighting the field in red because it's set to mandatory:
My only solution so far is to do the focus on a setTimeout of about two seconds but that really isn't a sensible option. If anyone has an alternative fix for this I'd like to hear about it!