Difference between Jquery Html callback function and append function? -


what difference between jquery html callback function (source http://www.w3schools.com/jquery/jquery_dom_set.asp) , jquery append function (source http://www.w3schools.com/jquery/jquery_dom_add.asp)

also ecsctly use of parameter index in jquery html callback function?

callback used manipulate content of html element. here can put logic handle text provided , return modified text.

in below code, adding original text new 1 return index. same way can put own logic handle text.

$("#test1").text(function(i, origtext){     return "old text: " + origtext + " new text: hello world!      (index: " + + ")";  }); 

while in append got choice add more text after existing text , nothing can done extra.

in below example, appending new text existing text.

$("p").append("some appended text."); 

Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -