views:

75

answers:

2

Hi all,

i have following simple code for a word/tag in a tagcloud:

<a about="http://localhost/d456c6" href="http://localhost/d456c6" class="tagweight0 Resource">abda</a>

i want to change the background on click of a word. the problem is, that i have not only one word with class "tagweight0".

Here my jQuery example code:

$('tagweight0').livequery('click', function(event) {
    $("tagweight0").toggleClass("select");
    return false;
});

This is working, but on click all words with class "tagweight0" are with changed background. How can i change the background only for the choosen word and not for all tags?

edit: can i make the change using the "href" or the "about" parameters?

+8  A: 
$('.tagweight0').live('click', function(event) {
    $(this).toggleClass("select");
    return false;
});
RaYell
it works now ;)
cupakob
A: 

how about just using css?

a:active
{
    background: #555555;
}
Natrium
not in this case ;)
cupakob
why is this not possible?
Natrium
I want to have more than one word with changed background and not only during the click event.
cupakob
ok, I see.
Natrium