问题描述:

I want to change this (which gets a span name in my table):

$('span').on('mouseover', function () {

if (this.id.match(/_zUserId/)) {

alert(this.id);

}

}

To use:

window.onmouseover=function(e) {

...

...

}

But I couldn't figure out how to get the span name from e.target. I don't know what to put after the e.target to get the span name.

网友答案:

Here the JSFiddle example.

window.onmouseover=function(e) {
    if (e.target.id=='mySpan') {
        alert(e.target.id);
    }
}
相关阅读:
Top