tags:

views:

37

answers:

4

Hi

I need to change the font color on the first link.

<a href="/default.aspx" class="content">Frontpage</a>    
<a href="/default.aspx" class="content" id="product_randomnumber_link">Frontpage</a> 

But I just can't figure out a way to only select the first a.

+1  A: 

This might work :

$("a").not("a[id]").css("color","#F0F");
Kaaviar
I think the `a` in your `not` bit is redundant, but nevertheless, it ought to work.
Mark
`.attr()` ? I guess you mean `.css()`
Reigel
+1  A: 

Try $('a:not([id])') or $('a:not([id]):first').

janmoesen
Thx got it working with $('.content:not([id])').css('color', '#FFFFFF');
gulbaek
A: 
$('a.content[id=""]:first').css('color','#fff');
Reigel
`id=""` does not work for me if there is no id attribute at all. (chrome)
jAndy
@jAndy - woooh? okay... cheers!
Reigel
A: 
$('a.content[id=]').css('color', '#ffffff');
jAndy