jquery中的焦点事件

大城市里の小女人 提交于 2019-12-06 17:35:29
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="./jquery-1.12.4.min.js"></script>
    <script>
        $(function(){
            //获取焦点 focus
            $('.one').focus();
            $('.one').focus(function(){

                    console.log('监听 失去焦点事件');
            })

            //失去焦点 blur
            $('.one').blur(function(){
                console.log('失去 焦点事件');
            });
        })
    </script>
</head>
<body>
    <input type="text" name="" id="" class="one" placeholder="1111">
    <input type="text" name="" id="" class="two" placeholder="2222">
</body>
</html>

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!