题解 | #单向绑定#

单向绑定

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

不支持 const / let,要用 var,莫非在线解释器/编译器用的是 ES5 语法?!

<!DOCTYPE html>
<html>

<head>
  <meta charset=utf-8>
</head>

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

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

    input.onchange = (e) => {
      span.innerText = input.value
    }
  </script>
</body>

</html>

全部评论
难怪半天没通过
点赞 回复 分享
发布于 2023-10-08 00:09 江苏

相关推荐

2025-12-18 11:59
广州南方学院 C++
牛客78682892...:直接点还好,总比要了简历也不回的强
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务