Avatar of cooljavabeans
cooljavabeans

asked on 

Mozilla issue with Javascript - setting focus on a button

Hi
The experts have helped me before with a javascript / mozilla issue, I'm hoping for the same timeous brilliant expertise again!
I am calling a javascript method from a tab on a GUI page in order to try and set the focus to a specific button, which is for a specific situation.

Please see my 2 methods. The first one works fine in IE but not Mozilla
The 2nd one is my attempt at getting it to work in Mozilla but doesn't work.
function setFocusButton() { // works fine in IE, but not in Mozzilla
        var elID = 'searchContactsButton';
        document.getElementById(elID).focus();
        return false;
}
//my attemt at adjusting this for Mozilla which doesnt work
function setFocusButton() { // works in IE but not Mozilla
        var elID = 'searchContactsButton';
        setTimeout(document.getElementById(elID).focus(),1);
        setTimeout(document.getElementById(elID).select(),1);
        return false;
}

Open in new window

JavaScript

Avatar of undefined
Last Comment
purplepomegranite

8/22/2022 - Mon