jquery - how parameter inside function works? -
html
<p>this <b>bold</b> paragraph.</p> <button>add</button>
jquery
$("button").click(function(){ $("p").text(function(i,origtext){ return "old text: " + origtext + " new text: hello world! (index: " + + ")"; }); });
i know origtext not called outside function returning value. how?
function(index, text)
a function returning text content set. receives index position of element in set , old text value arguments.
Comments
Post a Comment