关于input和select标签属性和onclick事件、onchange事件
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
</style>
</head>
<body>
<input type="text" value="请输入文字">
<button>点击修改input中的内容为emo</button>
<br>
<select id="sel" value="昨天">
<option value="昨天">昨天</option>
<option value="今天">今天</option>
<option value="明天">明天</option>
</select>
<script>
var inp = document.querySelector('input')
console.log(inp.value);
console.log(inp.value = 'hahaha');
inp.onblur = () => {
console.log(inp.value);
}
document.querySelector('button').onclick = () => {
inp.value = "更改了"
}
document.querySelector('#sel').onchange = () => {
console.log(document.querySelector('#sel').value);
}
</script>
</body>
</html>