-
Notifications
You must be signed in to change notification settings - Fork 1
event
Wolfy87 edited this page Nov 15, 2010
·
17 revisions
$(string element, object context).event(string type, function callback)
element - The CSS selector string to your element.
context - If supplied, the context in which you wish the selection to take place.
type - The type of event that has to take place in order for it to be triggered.
Possible types are
- load
- unload
- blur
- change
- focus
- reset
- select
- submit
- abort
- keydown
- keypress
- keyup
- click
- dblclick
- mousedown
- mousemove
- mouseout
- mouseover
- mouseup
callback - The function you wish to be run when the element is clicked, passes the event to the callback function.
Passes the event's return to the callback. For events such as click you can get the clicks location with pageX and pageY. This is usually not cross browser but Spark fixes this on runtime so you can use one value for all browsers.
Set a click event with a callback function.
$('a.myButton').event('click', function(e) {
alert('pageX = ' + e.pageX);
});