JQuery: addClass() not changing background on selector

Posted by centr0 on Stack Overflow See other posts from Stack Overflow or by centr0
Published on 2010-04-19T17:46:26Z Indexed on 2010/04/19 18:13 UTC
Read the original article Hit count: 122

Filed under:
|

im having a little trouble getting the background image to swap out on click()

    $('.highlight-boxes li a[class!=selected-box]').click(function() {
        $('.highlight-content').hide();
        $('.highlight-boxes li a').removeClass(); 
        $(this).addClass('box-selected');  // problem here
        var selected = $(this).attr('href').substr(1);
        $('#' + selected).stop(true,true).fadeIn();

        return false;
    });

console.log() in firebug returns the correct element being clicked but $(this).addClass('box-selected') does not change the background of the currently clicked element.

any ideas?

TIA

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about addclass