jquery - Accessing $(this) within a callback function -
This) does not work correctly because jPrompt () does not return any value, but uses the callback function.
Then say that I have something that works:
Click $ ("a.foo") (function () {$ (this) .text (quick ("type something", ""));} When I change it, it breaks:
$ ("A.foo"). Click (function () {jPrompt ("some type:", "", "", $ (this) properly
Try it out:
$ ("a.foo" ). (Function () {var that = this; JPrompt ("Type something:", "", "", function (r) {$ (that) .text (r);}} < / Pre>
Comments
Post a Comment