检测在jQuery中单击了哪个下拉框 [英] Detect which dropdown box was clicked in jquery

查看:95
本文介绍了检测在jQuery中单击了哪个下拉框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用id: assignee, status , priority在多个下拉框上执行相同的功能.

I am executing the same function on multiple dropdown boxes with id: assignee, status , priority.

$("#assignee , #status , #priority").change(function() { 

//text here

}

但是我想知道单击了哪个特定的下拉列表.有什么方法可以做到吗?

But I want to know which specific dropdown was clicked. Is there any method to do this?

推荐答案

只需使用以下内容:

$("#assignee, #status, #priority").change(function() { 
    if (this.id === "assignee") { ... }
});

这篇关于检测在jQuery中单击了哪个下拉框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆