搜索框获取转移焦点事件
作者:互联网
搜索框实例
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
搜索框<input type="text" value="618大促" id = 'i1'>
<script>
let iEle = document.getElementById('i1');
iEle.onfocus = function () {
iEle.value = ''
};
iEle.onblur = function () {
iEle.value = '有钱就买MAC'
}
</script>
</body>
</html>
标签:function,onblur,iEle,焦点,value,获取,MAC,搜索 来源: https://www.cnblogs.com/ruhai/p/10969876.html