2012-02-12 40 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 
}); 
相關問題