javascript - focusin()绑定触发函数后,如何在focusout()销毁已绑定的内容?
阿神
阿神 2017-04-10 12:43:07
0
1
652

之所以用focusin(),是因为他支持父元素上检测子元素失去焦点的情况。
一个一个移除太麻烦了。

阿神
阿神

闭关修行中......

全部回覆(1)
巴扎黑

使用 off 解绑就可以。

target.off('focusin');

示例:http://jsfiddle.net/UUPHq/

<input id="test" placeholder="点我"/>
 <span id="console"></span>​​​​​​​​​​​​​​​​​​​​​​​​​​​
var target = $('#test');
  var console = $('#console');
  target.focusin(function() {
      console.text('focusin');
  });
  
  target.focusout(function() {
      console.text('focusout');
      target.off('focusin');
  });​
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!