动态地关注模糊的可信度

时间:2014-07-15 23:40:12

标签: javascript jquery

http://codepen.io/anon/pen/rhnuE

我正在使用来自 - https://github.com/jeresig/jquery.hotkeys

的JS热键

我想要做的是取消选择/关注一个有针对性的有抱负的元素。我还想要在按下时从[Esc]键中单击全部调用的元素时删除默认焦点虚线。

如果有人能帮助它,我们将非常感激。

$(document).ready(function() {
  // Shortcut to deselect element
  $(document).bind('keydown', 'esc', function() {
    $('.box').focusout();
  });
});

1 个答案:

答案 0 :(得分:3)

尝试使用

    $('.box').blur()

而不是foucusout()它对我来说很好。

$(document).ready(function() {
  $(document).keyup(function(e) {
  if (e.keyCode == 27) { // Key 27 is the same as Esc
    $('#formId').blur();
  }
 });
});
相关问题