0

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;
 });
})
4

1 に答える 1

0

私はあなたがオフしたいと思います

$("a").on("click",function() {
  $email.off();
});
于 2012-08-13T19:31:26.480 に答える