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

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -