jquery hover()的使用

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <meta charset="utf-8" />
    <script src="jquery-3.3.1.js"></script>
    <script>
        $(function () {
            $('input').hover(function () {
                $(this).css('background', 'red');//鼠标进入
            }, function () {
                $(this).css('background', 'white');//鼠标离开
            })

        })
    </script>
</head>
<body>
    <input type="text" name="name" value="" />
</body>
</html>

posted @ 2018-04-08 20:02  dxm809  阅读(105)  评论(0编辑  收藏  举报