* [ jQuery ](https://jquery.com/ "jQuery")
  * [ jQuery UI ](https://jqueryui.com/ "jQuery UI")
  * [ jQuery Mobile ](https://jquerymobile.com/ "jQuery Mobile")
  * [ Sizzle ](https://sizzlejs.com/ "Sizzle")
  * [ QUnit ](https://qunitjs.com/ "QUnit")

  * [ Plugins ](https://plugins.jquery.com/)
  * [ Contribute ](https://contribute.jquery.org/)
    * [ CLA ](https://cla.openjsf.org/)
    * [ Style Guides ](https://contribute.jquery.org/style-guide/)
    * [ Bug Triage ](https://contribute.jquery.org/triage/)
    * [ Code ](https://contribute.jquery.org/code/)
    * [ Documentation ](https://contribute.jquery.org/documentation/)
    * [ Web Sites ](https://contribute.jquery.org/web-sites/)
  * [ Events ](https://events.jquery.org/)
  * [ Support ](https://jquery.com/support/)
    * [ Learning Center ](https://learn.jquery.com/)
    * [ Chat ](https://jquery.com/support/)
    * [ Stack Overflow ](https://stackoverflow.com/tags/jquery/info)
    * [ Report a bug ](https://contribute.jquery.org/bug-reports/)
  * [ OpenJS Foundation ](https://openjsf.org/)
    * [ Join ](https://openjsf.org/about/join/)
    * [ Members ](https://openjsf.org/about/members/)
    * [ jQuery Team ](https://jquery.com/team)
    * [ Governance ](https://openjsf.org/about/governance/)
    * [ Conduct ](https://code-of-conduct.openjsf.org/)
    * [ Donate ](https://openjsf.org/about/project-funding-opportunities/)

##  [ jQuery API Documentation ](https://jquery.com/ "jQuery API
Documentation")

Navigation

  * [ Download ](https://jquery.com/download/)
  * [ API Documentation ](https://api.jquery.com/)
  * [ Blog ](https://blog.jquery.com/)
  * [ Plugins ](https://plugins.jquery.com/)
  * [ Browser Support ](https://jquery.com/browser-support/)

#  .on()

* * *

Categories:  [ Events ](https://api.jquery.com/category/events/) > [ Event
Handler Attachment ](https://api.jquery.com/category/events/event-handler-
attachment/)

##  .on( events [, selector ] [, data ], handler )  Returns: [ jQuery
](http://api.jquery.com/Types/#jQuery)

**Description:** Attach an event handler function for one or more events to
the selected elements.

  * ####  version added: [ 1.7 ](/category/version/1.7/) .on( events [, selector ] [, data ], handler ) 

    * **events**

Type: [ String ](http://api.jquery.com/Types/#String)

One or more space-separated event types and optional namespaces, such as
"click" or "keydown.myPlugin".

    * **selector**

Type: [ String ](http://api.jquery.com/Types/#String)

A selector string to filter the descendants of the selected elements that
trigger the event. If the selector is ` null ` or omitted, the event is always
triggered when it reaches the selected element.

    * **data**

Type: [ Anything ](http://api.jquery.com/Types/#Anything)

Data to be passed to the handler in [ ` event.data ` ](/event.data/) when an
event is triggered.

    * **handler**

Type: [ Function ](http://api.jquery.com/Types/#Function) ( [ Event
](http://api.jquery.com/Types/#Event) eventObject [, [ Anything
](http://api.jquery.com/Types/#Anything) extraParameter ] [, ... ] )

A function to execute when the event is triggered. The value ` false ` is also
allowed as a shorthand for a function that simply does ` return false ` .

  * ####  version added: [ 1.7 ](/category/version/1.7/) .on( events [, selector ] [, data ] ) 

    * **events**

Type: [ PlainObject ](http://api.jquery.com/Types/#PlainObject)

An object in which the string keys represent one or more space-separated event
types and optional namespaces, and the values represent a handler function to
be called for the event(s).

    * **selector**

Type: [ String ](http://api.jquery.com/Types/#String)

A selector string to filter the descendants of the selected elements that will
call the handler. If the selector is null or omitted, the handler is always
called when it reaches the selected element.

    * **data**

Type: [ Anything ](http://api.jquery.com/Types/#Anything)

Data to be passed to the handler