js注册在标签上的点击事件

<div id="trFormatStr_1" onclick="fnTrClick(this)">点击</div>

function fnTrClick(dd){
    console.log("window对象",this, "当前对象",$(dd).attr("id"));
}
给onclick传递一个this,点击的当前对象,在函数中使用的this是window对象

原文地址:https://www.cnblogs.com/Zting00/p/7497693.html