There are no tracking or monitoring cookies on this site. There are only cookies used for documentation examples related to cookies.
Close

Processing...
This may take a few seconds.

focus-on-previous-cycle

Syntax

focus-on-previous-cycle: (selector set) [end-of-field] [every (time)] [after (time)][, (element)...];

selector set = Any valid CSS selector referencing multiple elements.

end-of-field = after focus places the cursor at the end of the field, if the field handles text.

When this command is run, the selector set will be scanned, and if the currently focused element is found in there, it will change the focus to the previous element in the selector set.

If the focused element is already at the beginning of the set, it will find the last element in the set and focus that.

This command runs a JavaScript "focus" event.

Note: This won't work well with click events triggering this action. The reason being that when you click, you lose the current focus. It is no longer part of the selector set - the focus gets put onto the object you clicked on. So it is best used with keyboard events. We may expand this to remember the last input field focused so the command ignores the click focus, but for now just use it with keyboard events.

Also note that it will only work on elements that can receive focus.

focus-on-previous-cycle