jQuery 第一個(gè)jquery程序
jquery ?我們習(xí)慣稱(chēng)為jq
下面我們來(lái)寫(xiě)第一個(gè)jq的程式
點(diǎn)擊一個(gè)按鈕給div 加入文字
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>第一個(gè)jquery程序</title> <style type="text/css"> #dv{ width:150px; height:150px; border:1px solid red; } </style> <script src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script> //引入js <script> $(function(){ $('#but').click(function(){ $('#dv').html("php中文網(wǎng)"); }); }); </script> </head> <body> <div id="dv"></div><br> <input type="button" value="按鈕" id="but"> </body> </html>
看上面程式碼:首先我們寫(xiě)jq程式碼時(shí)
要先寫(xiě)?
?$(function(){
????程式碼區(qū)塊
#})
然後我們?cè)诔淌酱a區(qū)塊去寫(xiě)功能性程式碼