使用时
$(document).on('dblclick', '#selector_id', {form_key:10}, my_function)
my_function = function(){
console.log(event)
}
,我希望能够从form_key
检索event.data
但是,在这种情况下,我得到的是MouseEvent
,而不是Event
,而且它没有data
属性。
我错过了什么?
答案 0 :(得分:8)
添加您尝试使用的参数,它可能有效:
$(document).on('dblclick', '#selector_id', {form_key:10}, my_function)
function my_function(event){ // <- event
console.log(event)
}
并记住传递的数据在event.data中可用,例如:
event.data.form_key