ya我只想在焦点文本框具有特定ID的情况下运行一些代码。这是我的代码:$("input:text").focus(function() { if ($(this) == $("#divid")) { //action } }); 它不起作用,我不确定为什么。 最佳答案 尝试直接按ID比较。if (this.id === "divid") { // do something }