「Jquery入門」text()、html() と val()のコールバック(callback)関数

2018年6月1日

JSコード:
$(“#btn1").click(function(){
$(“#test1").text(function(i,orgTxt){
return “元テキスト: " + orgTxt + " 新テキスト: Hello world! (index: " + i + “)";
});
});

$(“#btn2").click(function(){
$(“#test2").html(function(i,orgHml){
return “元html: " + orgHml + " 新 html: Hello <b>world!</b> (index: " + i + “)";
});
});

jQuery

Posted by arkgame