Stopping IE field focus on page load

  • 16 December 2017
  • 6 replies
  • 0 views

Badge +2

I have a form part way down a page, and when viewing the page in Internet Explorer, it causes the page to scroll down to my form upon pageload.  Can someone help me with the code to prevent the page from scrolling down to the first form field after page load? It only occurs in IE. Not Chrome.


6 replies

Userlevel 6
Badge +16

You can use the Javascript method .focus();

Badge +2

I have, and it didn't seem to be working but might have been a cache issue. 

I think this code is working for me, using a script editor to place it on the page.

$( document ).ready(function() {  $("pageTitle").focus();});
Userlevel 3
Badge +12

Hi Corbett,

Try replacing your code in NWF.FormFiller.Events.RegisterAfterReady instead $(document).ready(), for more details about this event, please refer this link.

Thank you.

Badge +2

Thank you.  I am now using: 

NWF.FormFiller.Events.RegisterAfterReady(function () { NWF$('.nf-associated-control').blur(); });

Seems to be working...

Userlevel 3
Badge +12

Glad to hear that it is working, please mark it as "answered" if it resolves your issue, so that it would be useful for other community users.

Badge +2

I am also facing the same issue, but unable to prevent the auto scroll to the first field using the above approach.

Is their any other way to achieve it

Reply