<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<title>Document</title>
</head>

<body>
<!-- oninput方法在输入框内容发生变化时触发 -->
<p >

</body>
<script>
var txt = document.getElementById('txt');
var ptxt = document.getElementById('p');
function watch() {
ptxt.innerHTML=txt.value;
console.log(txt.value)
}
</script>

</html>

相关文章: