← All examples

JavaScript Developer & QA

Tab order visualizer

Numbers every tabbable element by overlaying sequential numbers in visible badges on each one.

Code to copy

try {
  const sel = 'a[href], button, input, select, textarea, [tabindex]';
  let n = 0;
  document.querySelectorAll(sel).forEach(function (el) {
    if (el.disabled || el.tabIndex < 0) return;
    n++;
    const tag = document.createElement('span');
    tag.textContent = n;
    tag.style.cssText = 'position:absolute;z-index:99999;background:#9D0006;'
      + 'color:#fff;font:10px monospace;padding:1px 4px;border-radius:3px;';
    const r = el.getBoundingClientRect();
    tag.style.left = (r.left + window.scrollX) + 'px';
    tag.style.top = (r.top + window.scrollY) + 'px';
    document.body.appendChild(tag);
  });
  console.log('JustZix: ' + n + ' tabbable elements numbered');
} catch (err) { console.error('JustZix tab order:', err); }

How to use this example

  1. Copy the code with the button above.
  2. Install JustZix (2 minutes) and open the extension on the target page.
  3. Add a new rule matching that page.
  4. Paste the code into the rule's JavaScript panel and save — it runs on every page visit.

Rate this example

No ratings yet — be the first.

Does this example work?

Snippets are useless without somewhere to paste them.

JustZix takes 2 minutes to install and runs your code on every matching page. No account, no payment.

Download free See use cases