【发布时间】:2018-04-19 02:39:29
【问题描述】:
例如:
function helloworld(){
alert("helloworld");
}
function worldhello(){
alert("worldhello");
}
两个功能和三个按钮。
点击'A'按钮将执行helloworld()函数。
点击'B'按钮将执行worldhello()函数。
当你点击'C'按钮时,helloworld ()函数被执行,worldhello ()函数被执行。
我想防止在单击'C'按钮时执行helloworld()函数的警报。
我尝试使用event.target.id 和$(event.target).attr("id") 在helloworld() 函数中找到'C' 按钮的id,但它打印了undefined。
如何在helloworld ()函数中找到'C'按钮的id?
【问题讨论】:
-
I tried to use能否发布您尝试过的代码,以便我们尝试调试它? -
@CertainPerformance 此代码是示例..
标签: javascript events target