jQuery文本框内容输入同步功能

这段代码实现了文本框内容输入同步效果。

 1 <!DOCTYPE html>
 2 <html>
 3 <head>
 4 <meta charset=" utf-8">
 5 <title>jQuery文本框内容输入同步功能</title>
 6 <script src="http://www.uweier.com/skin/uweier/js/jquery.js"></script>
 7 <script>
 8 $(document).ready(function(){
 9   $("#top").keyup(function(){
10     $this=$(this);
11     $("#bottom").val($this.val());
12   })
13 })
14 </script>
15 </head>
16 <body>
17 <input type="text" id="top"/>
18 <br/><br/>
19 <input type="text" id="bottom"/>
20 </body>
21 </html>

 

posted @ 2019-04-18 16:03  ittalk  阅读(391)  评论(0)    收藏  举报