jQuery ??
??? ?? - text(), html() ? val()
?? ?? ??? ? ?? ??? ???? ???? ?????.
text() - ??? ??? ???? ????? ?????. html() - ??? ??(HTML ?? ??)? ??? ????? ?????. val() - ?? ??? ?? ????? ?????.
?? ???? text(), html() ? val? ???? ??? ?????. () ??? ???? ?? ?? ??
text(), html() ? val()
?? ? ?? jQuery ???? text(), html() ? val()?? ?? ??? ????. ?? ??? ??? ?? ??? ?? ?? ??? ???? ??(??) ???? ? ?? ????? ?????. ?? ?? ??? ? ??? ????? ???? ?????.
?? ?? - attr()
jQuery attr() ???? ?? ?? ??/???? ??? ?????.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"> </script> <script> $(document).ready(function(){ $("button").click(function(){ $("#php").attr("href","http://ipnx.cn/jquery"); }); }); </script> </head> <body> <p><a href="http://ipnx.cn" id="php">php中文網(wǎng)</a></p> <button>修改 href 值</button> <p>點(diǎn)擊按鈕修改后,可以點(diǎn)擊鏈接查看鏈接地址是否變化。</p> </body> </html>
attr() ???? ???? ??? ?? ??? ??? ?? ????.
attr() ?? ??
jQuery ??? attr()? ?? ??? ?????. ?? ??? ??? ?? ??? ?? ?? ??? ???? ??(??) ???? ? ?? ????? ?????. ?? ?? ??? ? ??? ????? ???? ?????.