前端输入框失去焦点与获取焦点事件

页面加载时

window.onload=function(){
    
    
    $('input[name=xxx]').blur(function () {
    
    
        console.log('失去焦点4')
    })
}

另一种写法

在这里插入图片描述

获取焦点

$("input[name=xxx]").focus();

猜你喜欢

转载自blog.csdn.net/weixin_48860638/article/details/121752254
今日推荐