Hi!
Use document.activeElement, it is supported in all major browsers.
For more details on document.activeElement browser compatibility, check this https://developer.mozilla.org/en/DOM..._compatibility
If You are not still getting document.activeElement in your form, try to do following:-
Code:
if (!document.activeElement) {
//Step 1:- Add a "focus" event handler to all fields .
//Step 2:- Record the last-focused field in a variable.
//Step 3:- Add a "blur" handler to clear the variable upon a blur event for the last-focused field.
}