题解 | #单向绑定#

单向绑定

https://www.nowcoder.com/practice/728b83e2b9b948dbababcc4a494eefc3

<!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>
</head>

<body>
    <input id="input" type="text" />
    <span id="span"></span>

    <script type="text/javascript">
        // 补全代码
        let oInput = document.getElementById('input');
        let oSpan = document.getElementById('span');

        oInput.onchange = () => {
            oSpan.innerHTML = oInput.value;
        }

    </script>
</body>

</html>

全部评论

相关推荐

头像
05-12 09:14
点赞 评论 收藏
转发
点赞 评论 收藏
转发
点赞 收藏 评论
分享
牛客网
牛客企业服务