检查是否单击了两个元素之一 [英] Check if one of two elements are clicked
本文介绍了检查是否单击了两个元素之一的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在检查是否单击了这样的一个按钮
I am checking if one button is clicked like this
$j('#Button1').click( function () {
然后执行一个功能,但是现在我想在单击Button1或Button2时执行相同的功能.
and then performing a function but now I want to perform the same function when either Button1 or Button2 is clicked.
它的jQuery语法是什么?
What is the jQuery syntax for that?
推荐答案
您可以执行以下操作:
$j('#Button1, #Button2').click( function () {
这篇关于检查是否单击了两个元素之一的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文