Sometimes focus on a specific form element will not work in Firefox.
To make it work in Firefox, we can use settimeout function.

The function setTimeout() executes the javascript code after a specified time interval.
Syntax : setTimeout(“javascript statement”,milliseconds);

The first parameter of setTimeout() is a string that can contain any JavaScript statement.
The second parameter indicates how many milliseconds from now we want to execute the first parameter.

To focus on a particular form element, we can give the following statement :

settimeout(function() { ptr.focus();} , 0) where ‘ptr’ is the form element.