鉴于以下单击处理程序,我无法记录e.currentTarget或jQuery通常返回的大多数对象。这只发生在IE8中。
clickHandler: function(evt){
//do stuff
console.log('evt: ', evt);
}
如果我记录这个事件,我只会得到一些属性,就像这样。我如何获得完整的活动?
LOG: evt:{
"type": "click",
"jQuery111008085261648353432": true,
"toElement": null,
"screenY": 465,
"screenX": 327,
"pageY": 280,
"pageX": 278,
"offsetY": 39,
"offsetX": 257,
"fromElement": null,
"clientY": 280,
"clientX": 278,
"button": 0,
"which": 0,
"shiftKey": false,
"metaKey": false,
"ctrlKey": false,
"altKey": false,
"handleObj": {
"type": "click",
"origType": "click",
"guid": 113,
"selector": "p, li, input, textarea, h1, h2, h3, h4, h5, h6, th, td",
"needsContext": false,
"namespace": "delegateEventsview103"
}
}
以下是我为事件定义的内容:
'click p, li, input, textarea, h1, h2, h3, h4, h5, h6, th, td' : 'clickHandler'
答案 0 :(得分:1)
试试这个: //支持IE6-8
var target = e.target || e.srcElement;
如果不支持e.target(未定义),则返回e.srcElement