I am writing js recently, ah, js cross-browser Events are lost too much, and jquery is the same. .
The author recently wrote a demo... This problem has troubled me for a week. . .
The code explains the reason:
$("#div1").mouseup(function(e) { alert(e.target.id); });
I really hope to get the ie of the dom object triggered by the object after the mouse is released. ..All elements on the page have ids. . .
Finally solved
$("#div1").mouseup(function(e) { var oEvent=e||event; alert(oEvent.target.id); });
Ah, annoying js
Insert a small knowledge point here:
The coordinates of mouse movement in mousemove Determine the current moving node type. id
document.elementFromPoint(oEvent.pageX,oEvent.pageY).id;//获取di document.elementFromPoint(oEvent.pageX,oEvent.pageY).tagName;//获取节点tag name
The above is the detailed content of Detailed explanation of mouseup event attribute loss in jquery. For more information, please follow other related articles on the PHP Chinese website!