jQuery Newbie, need a little help
<p>Okay, so I am in the process of recreating this feature:</p>

<p><a href="http://www.w3.org/html/logo/#the-technology" rel="nofollow">http://www.w3.org/html/logo/#the-technology</a></p>

<p>I current have it so when you click on a link, it will add a class to the image that relates to that link (href="#one" on the <code>&lt;a&gt;</code> and then id="#one" on the <code>&lt;img&gt;</code>), however it is currently not going through each <code>&lt;a&gt;</code> tag and only one. And also it is not removing the class I requested.</p>

<p>Code follows:</p>

<p><strong>JS</strong></p>

<pre><code>$(document).ready(function() {

var container = '#portfolio #text_container';

var img_container = '#portfolio #image_container';

$(container).children('a').bind('click', function() {

var this_attr = $(this).attr('href');

var this_img = $(img_container).find('img').attr('id');

if(this_attr == this_img) {

    //$(img_container).find('img').hasClass('current').removeClass('current');

        // ^^^ This line isn't working, any ideas? :/

    $(img_container + ' img[id*="' + this_attr + '"]').addClass('current');

}

else {

    alert(this_img + ' this img');

        alert(this_attr + ' this attr');

}

  });

});
</code></pre>

<p>And the HTML is as follows</p>

<pre><code>&lt;div id="portfolio"&gt;

    &lt;div id="image_container"&gt;
        &lt;img src="http://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif" alt="" class="current" id="#one" /&gt;
        &lt;img src="http://static.jquery.com/files/rocker/images/btn_downloadLarge.gif" alt="" id="#two" /&gt;
    &lt;/div&gt;

    &lt;div id="text_container"&gt;
        &lt;a href="#one" class="link"&gt;Item 1&lt;/a&gt;
        &lt;a href="#two" class="link"&gt;Item 2&lt;/a&gt;

        &lt;p id="#one" class="current"&gt;A bunch of text!&lt;/p&gt;
        &lt;p id="#two"&gt;The second bunch of text!&lt;/p&gt;
    &lt;/div&gt;

&lt;/div&gt;
</code></pre>

<p>Please let me know if you need any more information :)</p>

<p><strong>rcravens fixed this with the following code..</strong></p>

<p><strong>JS</strong></p>

<pre><code>$(document).ready(function() {


    $('#text_container a').click(function(evt) {
        evt.preventDefault();

        $('.current').removeClass('current');

        var href = $(this).attr('href');

        $("." + href).addClass('current');


    });
</code></pre>

<p><strong>And the HTML..</strong></p>

<pre><code>&lt;div id="portfolio"&gt;

    &lt;div id="image_container"&gt;
        &lt;img src="http://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif" alt="" class="one current" /&gt;
        &lt;img src="http://static.jquery.com/files/rocker/images/btn_downloadLarge.gif" alt="" class="two" /&gt;
    &lt;/div&gt;

    &lt;div id="text_container"&gt;
        &lt;a href="one" class="link"&gt;Item 1&lt;/a&gt;
        &lt;a href="two" class="link"&gt;Item 2&lt;/a&gt;

        &lt;p class="one current"&gt;A bunch of text!&lt;/p&gt;
        &lt;p class="two"&gt;The second bunch of text!&lt;/p&gt;
    &lt;/div&gt;

&lt;/div&gt;
</code></pre>
