首页 > Web开发 > 详细

jquery 弥补ie6不支持input:hover状态

时间:2015-08-10 17:24:48      阅读:151      评论:0      收藏:0      [点我收藏+]

<!doctype html>
<html>
    <head>
    <meta charset="utf-8">
    <title>jquery 弥补ie6不支持input:hover状态</title>
    <style type="text/css">
    input{border:1px solid #eee;}
    input:focus{border:1px solid #ccc;}
    .focus{border:1px solid #ccc;}
    </style>
    <script type="text/javascript" src="jquery-1.11.1.min.js"></script>
    </head>

    <body>
        <form action="#" method="get">
            <label for="name">用户名</label>
            <input id="name" type="text"/>
            <label for="pass">密码</label>
            <input id="pass" type="text"/>
        </form>
        <script type="text/javascript">
        $(function(){
            $(":input").focus(function(){
                $(this).addClass("focus");
            }).blur(function(){
                $(this).removeClass("focus");
            });
        });
        </script>
    </body>
</html>

jquery 弥补ie6不支持input:hover状态

原文:http://www.cnblogs.com/Better-Me/p/4718470.html

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