2012-02-12 37 views

回答

7

我相信blur函数是你正在寻找。

$("input[type=text]").blur(function() { 
    // unfocus event 
}); 
1

模糊事件将触发任何时候一个元素失去焦点。

如果您试图确定页面上的任何输入元素何时失去焦点,请使用输入作为选择器。

$("input").blur(function() { 
    //This event fires every time any input element on the page loses focus 
}); 

如果您只是想确定何时在页面上特定输入元素失去焦点,然后使用元素的ID是最有效的jQuery选择。

$("#exampleID").blur(function() { 
    //This event fires if the element with an id of "exampleID" loses focus 
}); 
相关问题