亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

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()? ?? ??? ?????. ?? ??? ??? ?? ??? ?? ?? ??? ???? ??(??) ???? ? ?? ????? ?????. ?? ?? ??? ? ??? ????? ???? ?????.


???? ??
||
<!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(){ $("#btn1").click(function(){ $("#test1").text(function(i,origText){ return "舊文本: " + origText + " 新文本: Hello world! (index: " + i + ")"; }); }); $("#btn2").click(function(){ $("#test2").html(function(i,origText){ return "舊 html: " + origText + " 新 html: Hello <b>world!</b> (index: " + i + ")"; }); }); }); </script> </head> <body> <p id="test1">這是一個(gè)有 <b>粗體</b> 字的段落。</p> <p id="test2">這是另外一個(gè)有 <b>粗體</b> 字的段落。</p> <button id="btn1">顯示 新/舊 文本</button> <button id="btn2">顯示 新/舊 HTML</button> </body> </html>