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

mac2022-07-05  31

<!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>

转载于:https://www.cnblogs.com/Better-Me/p/4718470.html

最新回复(0)