A couple things. First off, the syntax you're using won't get you the anchor's color:
$('a:link',this).css('color'); This is a shortcut for: $(this).find('a:link').css('color') which basically means find the anchors inside this anchor. If you want the anchor's original color, just use: $(this).css('color') Getting the color that is set by the CSS pseudo :hover is another problem. To get that via JavaScript you'd have to loop through the stylesheets cssRules and do a regex match. Michael On Oct 17, 10:59 am, Steven <html...@gmail.com> wrote: > Hello, > > I'm trying to make a basic, "dynamic" link color fader. Since I have > multiple link colors for different classes and divisions and such, I'm > trying to make it "dynamic." To do so I need to grab the original > color and the hover color. Here is my code: > > // Fading links > $('a').hover( > // Over > function(){ > var original_cl = $('a:link',this).css('color'); > var fade_cl = $('a:hover',this).css('color'); > alert('Original color: '+original_cl+'; Fade color: > '+fade_cl); > }, > // Out > function(){ > > } > ); > > Both colors come as undefined; experimentation tells that using > "a:link" or "a:hover" as the selector is invalid. How can I grab these > colors in context? > > Thanks, > Steven