1

I look for all links, which have a second classname, which starts with "_0". This classname works as a path for my internal use.

I tried the following queries with no success:

$('a.hint [class^=_0]') // hint is the name for the first class
$('a [class^=_0]')
$('a [class^=_0]')

Is there a short handy query to approach this?

Andreas
  • 591
  • 1
  • 4
  • 3

4 Answers4

0

Try: $('a.hint[class^="_0"]') (with quotes surrounding the _0) as described in the jquery doc example

[EDIT] If one of your classes is not exactly hint then you shouldn't use a.hint

$('a.hint[class^="_0"]') look for a a tag containing the exact class name hint and one of the classes name begining with _0

What you are looking for is more probably: $('a[class^="_0"]')

You should show us your HTML code, that would really help!

JMax
  • 26,109
  • 12
  • 69
  • 88
  • @Andreas: indeed, i forgot to remove the space between `hint` and `[` as Richard pointed out in his answer - i've edited my answer – JMax Aug 24 '11 at 08:52
0

You don't want a space after the a, also you could probably use the attribute contains selector instead:

$('a.hint[class*="_0"]')

http://jsbin.com/onazul/2/edit

Richard Dalton
  • 35,513
  • 6
  • 73
  • 91
0

try this-

$('a.hint [class^="_0"]')

Vivek
  • 10,978
  • 14
  • 48
  • 66
0

If you are sure that its your second class then you can use $("a [class*=' _0']"). Please refer to this link this should help you. Using 'starts with' selector on individual class names

Community
  • 1
  • 1
Vins
  • 8,849
  • 4
  • 33
  • 53