Two-way binding of input text with jquery

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<script type="text/javascript" src="js/jquery-1.11.0.js" ></script>
<body>
<input type="text" />
<p></p>
<script>
//输入的文字的双向绑定
$("input").keyup(function(){
var oText=$("input").val()
$("p").text(oText)
})
</script>
</body>
</html>

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325907804&siteId=291194637