<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
</style>
</head>
<body>
<input type="text" id="wbk">
<input type="text" id="user">
<script>
var wbk = document.getElementById("wbk");
wbk.oninput = function(e){
console.log("实时获取文本框内容:"+e.target.value);
};
wbk.onselect = function(){
console.log("文字被选中触发事件");
};
var user = document.getElementById("user");
user.onchange = function(e){
console.log("离开文本框后获取文字:"+e.target.value);
};
</script>
</body>
</html>