gulbaek
gulbaek

Reputation: 2541

Jquery get links where id is empty

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.

Upvotes: 1

Views: 123

Answers (4)

Boris Delormas
Boris Delormas

Reputation: 2549

This might work :

$("a").not("a[id]").css("color","#F0F");

Upvotes: 1

jAndy
jAndy

Reputation: 236012

$('a.content[id=]').css('color', '#ffffff');

Upvotes: 0

Reigel Gallarde
Reigel Gallarde

Reputation: 65264

$('a.content[id=""]:first').css('color','#fff');

Upvotes: 0

janmoesen
janmoesen

Reputation: 8020

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

Upvotes: 1

Related Questions