📜  js 焦点事件 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:16.633000             🧑  作者: Mango

代码示例2
const form = document.getElementById('form');

form.addEventListener('focus', (event) => {
  event.target.style.background = 'pink';    
}, true);

form.addEventListener('blur', (event) => {
  event.target.style.background = '';    
}, true);