can-EVENT

  • function
can.view.bindings.can-EVENT  

can-EVENT='KEY'

Specify a callback function to be called on a particular event.

Parameters

  1. EVENT {String}

    A event name like click or keyup. If you are using jQuery, you can listen to jQuery special events too.

  2. key {key}

    A named value in the current scope. The value should be a function.

Use

By adding can-EVENT='KEY' to an element, the function pointed to by KEY is bound to the element's EVENT event. The function is called back with:

  • context - the context of the element
  • element - the element that was bound
  • event - the event that was triggered