3
是否有可能檢測到用戶使用jquery忽略輸入框?即當他們點擊事件觸發時。用戶在使用jQuery時不關注輸入框時檢測?
是否有可能檢測到用戶使用jquery忽略輸入框?即當他們點擊事件觸發時。用戶在使用jQuery時不關注輸入框時檢測?
我相信blur
函數是你正在尋找。
$("input[type=text]").blur(function() {
// unfocus event
});
的模糊事件將觸發任何時候一個元素失去焦點。
如果您試圖確定頁面上的任何輸入元素何時失去焦點,請使用輸入作爲選擇器。
$("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
});