DOM focus helper
A tiny helper for placing focus where a controlled visible run needs it next.
Best for
Form flows and visible guided handoffs between steps.
Load with
RTO_form_api.js first.
Works well with
RTO_form_helpers.js and DOM highlight/style helpers.
Summary
Focus a selector inside a controlled tab.
- Exports:
RTOFocusElement - Depends on:
RTO_form_api.js - Auto-binds: buttons with
data-rto-focus - Uses data attributes:
data-rto-focus,data-rto-tabKey(recommended),data-rto-tabkey(legacy),data-rto-key(legacy)
What it is
Quick helper to focus an element inside a controlled tab (by selector).
Download
Download RTO_DOM_focus.jsExample
<button data-rto-tabKey="app" data-rto-focus="#email">Focus email field</button>
<script src="../RTO_helpers/RTO_form_api.js"></script>
<script src="../RTO_helpers/RTO_DOM_focus.js"></script>
Data attributes
data-rto-focus: selector in the remote tab (example:#email)data-rto-tabKey: tabKey (recommended)data-rto-tabkey: legacy alias (accepted)data-rto-key: legacy alias (accepted)