Passing $(this) selector into nested functions
<p>So I have a script in place that needs to go through each <code>P</code> tag within a parent <code>DIV</code> with the class name of <code>entry-content</code> and translate each one using the google translate API.</p>

<p>So when a user clicks a link to translate the page from english to spanish this function is run:</p>

<pre><code>function spanish() {
$(".entry-content p").each(function(){
      var text = $(this).html();
        google.language.detect(text, function(result) {
          google.language.translate(text, "en", "es", function(result) {
           if (result.translation) {
                alert($(this).html());  //outputs NULL
                $(this).html(result.translation); //doesn't work
            }
          });
        });
      });
}
</code></pre>

<p>The problem is when iIget to the inner function <code>$(this).html()</code> comesback NULL and I am not able to change the current elements html in order to change it to the new translated text.</p>

<p>So I guess my question is: 
How would I pass the current selected element into the nested functions?</p>

<p>Thanks</p>
