jquery 替換文本內容


 1 <!DOCTYPE html>
 2 <html>
 3 <head>
 4     <meta charset="utf-8">
 5     <meta http-equiv="X-UA-Compatible" content="IE=edge">
 6     <title></title>
 7     <script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>
 8 </head>
 9 <style>
10   #btnTex{width:80px; height:50px; margin: 10px;}
11   
12 </style>
13 <body>
14   
15 <input id="text1" type="text" />
16 <input id="btn1" type="button" value="按鈕" />
17 <p id="p1">這是一些文字</p>
18     <script  type="text/javascript" charset="utf-8">
19        $(function(){
20               var text1 = $('#text1');
21               var btn1 = $('#btn1');
22               var p1 = $('#p1');
23                btn1.click(function(){
24                 p1.html(text1.val());
25 
26               })
27             
28         
29           
30              
31        })
32    </script>  
33 </body>
34 </html>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM