亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

input綁定的document.onkeydown事件怎么銷毀?

input綁定的document.onkeydown事件怎么銷毀?

回首憶惘然 2018-09-02 09:13:37
在class為ipt1的input綁定focus事件,另外一個input也會觸發這個focus,請問如何銷毀?<el-input class="ipt1" type="textarea" @focus="focusIpt()"></el-input>  <el-input class="ipt2" type="textarea"></el-input><script>     focusIpt(){        let enterEvent = function(e){               ... // do something           }         document.onkeydown = enterEvent     } </script>
查看完整描述

2 回答

?
侃侃爾雅

TA貢獻1801條經驗 獲得超16個贊

document.onkeydown = undefined

查看完整回答
1 反對 回復 2018-09-02
?
寶慕林4294392

TA貢獻2021條經驗 獲得超8個贊

你監聽事件的時候,寫成標準的

document.addEventListener('keydown', fun);document.removeEventListener('keydown', fun);//移除監聽事件的回調函數


查看完整回答
反對 回復 2018-09-02
  • 2 回答
  • 0 關注
  • 5507 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號