can-EVENT
can.view.bindings.can-EVENT
can-EVENT='KEY'
Specify a callback function to be called on a particular event.
Parameters
-
EVENT
{String}
A event name like
click
orkeyup
. If you are using jQuery, you can listen to jQuery special events too. -
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 byKEY
is bound to the element'sEVENT
event. The function is called back with:context
- the context of the elementelement
- the element that was boundevent
- the event that was triggered