Example 1 — Basic .on("focus")
Official pattern: run a handler when #target gains focus.
$("#target").on("focus", function () {
$("#out").text("Handler for focus called.");
}); How It Works
- Bind.
.on("focus", fn)registers the callback on#target. - Enter. A click or Tab moves focus into the field.
- Fire. The browser sends the
focusevent.

