Possible Duplicate:
Given this code:
function myFunc(e) {
e.preventDefault();
}
var x = 99;
$('#myId').bind('click', myFunc);
Can someone tell me what is the e parameter. Also how could I pass the x parameter to myFunc ?
Possible Duplicate:
Given this code:
function myFunc(e) {
e.preventDefault();
}
var x = 99;
$('#myId').bind('click', myFunc);
Can someone tell me what is the e parameter. Also how could I pass the x parameter to myFunc ?
This is the click event, wrapped as a jquery event.
If you want to pass x, you may do this :
$('#myId').bind('click', {x:x}, myFunc);
Your function will find x
in e.data.x
.
If you need the native event (i.e. not the jQuery one), use e.originalEvent
but many fields of the event are accessible through e
.