event.type is a String that describes the nature of the event — "click", "keydown", or a custom name like "saveDraft". Since jQuery 1.0. It is the base name only (no namespace). Works with native events and .trigger().
Syntax
Start with these common calls. Keep them short and readable.
jQuery
event.type // "click", "keydown", "saveDraft", …
event.namespace // "myPlugin" for click.myPlugin (or "")
// Official pattern
$("a").on("click", function (event) {
alert(event.type); // "click"
});
Call
What it does
event.type
Learn jQuery event.type: the String base event name (click, keydown, custom), official anchor alert demo, multi-event handlers, .trigger() customs, vs event.namespace, examples, pitfalls, and FAQs.
Load jQuery before your script (CDN or local file), then wrap DOM work in $(function () { ... }) when needed.
Parameters
Parameter
Description
Step 1
Bind with .on("click", fn) or multi: .on("click keydown", fn).
Step 2
Inside the handler, read event.type.
Step 3
Branch with if / switch when one function handles several events.
Return Value
Return Value
Description
Value / undefined
Getters usually return a value from the first matched element, or undefined when nothing applies.
jQuery Examples
Example 1 — Official Anchor Click
Show event.type on every link click.
jQuery
$("a").on("click", function (event) {
event.preventDefault();
$("#out").text("event.type: " + event.type);
});
event.type is a String on the jQuery event object. It describes the nature of the event — for example "click", "keydown", or a custom name like "saveDraft". Available since jQuery 1.0. It holds the base event name without any namespace suffix.
Bind click on anchors: $("a").on("click", function(event) { alert(event.type); }); // "click". The alert shows the base type string for every anchor click.
For a bind like click.myPlugin, event.type is "click" (the base name) and event.namespace is "myPlugin" (the dotted suffix). event.type never includes the namespace.
Yes. Bind .on("click mouseenter mouseleave", fn) and branch with event.type — each dispatch sets type to whichever event fired.
Yes. When you .trigger("saveDraft") or bind .on("saveDraft", fn), event.type is "saveDraft". jQuery sets type for native DOM events and custom triggers alike.
Usually yes for native DOM events. For synthetic jQuery triggers with no underlying DOM event, originalEvent may be undefined while event.type still holds the triggered name. Prefer event.type in jQuery handlers.