ric*_*ier 1 jquery event-handling javascript-events
使用时
$(document).on('dblclick', '#selector_id', {form_key:10}, my_function)
my_function = function(){
console.log(event)
}
Run Code Online (Sandbox Code Playgroud)
我希望能够检索form_key从event.data,按照文档
但是,在这种情况下,我得到一个MouseEvent,而不是Event,它没有data属性.
我错过了什么?
添加您尝试使用的参数,它可能有效:
$(document).on('dblclick', '#selector_id', {form_key:10}, my_function)
function my_function(event){ // <- event
console.log(event)
}
Run Code Online (Sandbox Code Playgroud)
并记住传递的数据在event.data中可用,如:
event.data.form_key
Run Code Online (Sandbox Code Playgroud)