首页 > Web开发 > 详细

jquery对于输入框得到与失去焦点时的处理方法

时间:2019-10-27 12:17:35      阅读:105      评论:0      收藏:0      [点我收藏+]
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
    </head>
    <body>
        <p>帐号:&ensp;<input type="text" name="" id="" value="" /></p>
        <p>密码:&ensp;<input type="text" name="" id="" value="" /></p>
    </body>
</html>
<script src="jquery-3.4.1.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
    // focus() 输入框得到焦点时的处理
    // bulr()  输入框失去焦点时的处理
    $(function() {
        $(input:first).focus(function() {
            $(this).css(background, #eee);
        });
        $(input:first).blur(function() {
            $(this).css(background, #fff);
        });
        $(input:enabled).focus(function() {
            $(this).css(background, #eee);
        });
        $(input:enabled).blur(function() {
            $(this).css(background, #fff);
        });
    });
</script>

 

jquery对于输入框得到与失去焦点时的处理方法

原文:https://www.cnblogs.com/li1234567980/p/11746985.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!