can't call "this" properly in jQuery
<p>I have the following jQuery   which seems to be working fine except for: </p>

<pre><code>$(this).attr('src', 'img/upgreen.png');
</code></pre>

<p>Is there any reason why this wouldn't work ?</p>

<pre><code>$(function addThumbs() {
$('.vote-up').bind('click', function() {
    // 'this' is a DOM element
    // wrap 'this' in a jQuery object
    var img = $(this);
    // now we have the full jQuery API at our disposal
    var review_id = $('#review_id').val();
    var user_id = $('#user_id').val();


    if (user_id == 1) 
        { alert('...'); }
    else
     {
            $("#flash").show();
            $("#flash").fadeIn(400).html('&lt;img src="ajax-loader.gif" /&gt;Loading Comment...');
            $.ajax({
                        type: "POST",
                        url: "ajax-thumbsup.php",
                                data:{  
                                "user_id" : user_id, 
                                "review_id" : review_id       //we are passing the name value in URL
                                },
                        cache: false,
                        success: function(html)
                            {
                            $("#progressdiv").show();
                            $("#progressdiv").fadeIn(400).html('success');
                            $(this).attr('src', 'img/upgreen.png');
                            }
                    });
    }return false;
});
</code></pre>

<p>});</p>

<p>HTML inside a loop</p>

<pre><code>                                    &lt;div class="thumbs"&gt;
                                        &lt;input type="hidden" id="review_id" value="&lt;?php echo $review['review_id']?&gt;" /&gt;
                                        &lt;input type="hidden" id="user_id" value="&lt;?php echo $user_id ?&gt;" /&gt;
                                        &lt;div id="pluses"&gt;0&lt;/div&gt; &lt;div id="progressdiv"&gt;&lt;/div&gt;
                                        &lt;a&gt;&lt;img class="vote-up" src="img/up.png" alt="thumbs up" /&gt; &lt;/a&gt;

                                        &lt;a&gt;&lt;img class="vote-down" src="img/down.png" alt="thumbs down" /&gt; &lt;/a&gt;
                                        &lt;div id="minuses"&gt;0&lt;/div&gt;
                                    &lt;/div&gt;

                                    &lt;div class="thumbs"&gt;
                                        &lt;input type="hidden" id="review_id" value="&lt;?php echo $review['review_id']?&gt;" /&gt;
                                        &lt;input type="hidden" id="user_id" value="&lt;?php echo $user_id ?&gt;" /&gt;
                                        &lt;div id="pluses"&gt;0&lt;/div&gt; &lt;div id="progressdiv"&gt;&lt;/div&gt;
                                        &lt;a&gt;&lt;img class="vote-up" src="img/up.png" alt="thumbs up" /&gt; &lt;/a&gt;

                                        &lt;a&gt;&lt;img class="vote-down" src="img/down.png" alt="thumbs down" /&gt; &lt;/a&gt;
                                        &lt;div id="minuses"&gt;0&lt;/div&gt;
                                    &lt;/div&gt;
</code></pre>
