码迷,mamicode.com
首页 > Web开发 > 详细

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

时间:2015-08-10 17:27:14      阅读:106      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!