我遇到一个小问题,让jquery动作理想地运行。目前,在特定字段的模糊处理中,一切都正常工作,称为“person_email”。问题是,如果最终用户执行此操作,并决定单击超链接,例如在模糊触发的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;
});
})