Sorry if this is a 'noob' question. (I've heavily edited it to be clearer as to what I was looking for.) Consider some links:
<p><a class="bgColor_0" href="whatever">Click Me</a></p>
<p><a class="bgColor_1" href="whatever">Click Me</a></p>
<p><a class="bgColor_2" href="whatever">Click Me</a></p>
Somewhere else on the page there is a DIV which also uses the same class name. So in the stylesheet:
div.bgColor_1 {background-color: #ffffff; }
div.bgColor_2 {background-color: #00ffff; }
div.bgColor_3 {background-color: #ffff00; }
What I want is to get the value of the background-color property of the class of the clicked as a string (or a null if not set).
So I want to create a click function which tests for a class beginning with bgColor_
jQuery('a').click( function(){
myClass = jQuery(this).attr('class').match(/\bbgColor_\S+/g);
// eg. myClass = 'bgColor_0';
// now... how do I get the background-color property of bgColor_0?;
} );
What I want to get to is the -value- of the backgroundColor property of the div with the class myClass
eg. If the user clicked a.bgColor_1, I want to obtain the background-color property of the class div.bgColor_1 in the stylesheet and then assign another (to be determined) div to class bgColor_1 so I can change its colour.