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