js两个input框内容同步

时间:2021-02-22 12:05:55   收藏:0   阅读:0
<body>
    <input type="text" id="t1" > <br>
    <input type="text" id="t2" >
</body>
<script>
    document.getElementById(t1).oninput = function(){
        document.getElementById(t2).value = this.value;
    }
</script>

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!