2012-08-13 17 views
0

我有一個輕微的問題讓jquery動作功能理想。目前,所有內容都可以在來自特定字段(稱爲「person_email」)的模糊情況下正常工作。問題是,如果最終用戶這樣做,並決定點擊一個超鏈接,例如在模糊觸發器中的jquery頁面的其餘部分,用戶可以簡單地看到它,然後繼續到相應的鏈接。如何讓jquery模糊觸發除了超鏈接/輸入按鈕之外​​的任何東西

理想情況下,這將工作,模糊只會觸發,如果超鏈接沒有點擊。

var $email = $("#person_email"); 
var $hint = $("#hint_edit"); 

$email.on('blur',function() { 
    $hint.hide; // Hide the hint 
    $(this).mailcheck({ 
    suggested: function(element, suggestion) { 
     // First error - Fill in/show entire hint element 
     var suggestion = "Did you mean: <span class='suggestion'>" + 
         "<span class='address'>" + "</span>" + 
         "<a href='#' class='domain'>" + suggestion.address + 
         "@" + suggestion.domain + "</a></span>?"; 

     $hint.html(suggestion).fadeIn(150); 
    } 
    }); 
}); 

$hint.on('click', '.domain', function() { 
    // On click, fill in the field with the suggestion and remove the hint 
    $email.val($(".suggestion").text()); 
    $hint.fadeOut(200, function() { 
    $(this).empty(); 
    }); 
    return false; 
}); 
}) 

回答

0

我假設你想off

$("a").on("click",function() { 
    $email.off(); 
}); 
+0

謝謝你的提示mplugjan, – mcc 2012-08-13 19:52:42

相關問題