Erlo

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

2019-10-27 13:00:35 发布   741 浏览  
页面报错/反馈
收藏 点赞
DOCTYPE html>
html>
    head>
        meta charset="utf-8">
        title>title>
    head>
    body>
        p>帐号:input type="text" name="" id="" value="" />p>
        p>密码: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>

 

登录查看全部

参与评论

评论留言

还没有评论留言,赶紧来抢楼吧~~

手机查看

返回顶部

给这篇文章打个标签吧~

棒极了 糟糕透顶 好文章 PHP JAVA JS 小程序 Python SEO MySql 确认