Reputation: 5953
I'm trying to add a class based on the table cell starting with a particular a href.
This is the HTML:
<tr class="odd">
<td class=" sorting_1">
<a href="/workorders/1">13-10000</a>
</td>
I thought this would work, but it doesn't:
$('a[href$^="/workorders/"]').addClass("boldnowrap");
I'm actually using coffeescript:
$('a[href$^="/workorders/"]').addClass "boldnowrap"
Thanks!
Upvotes: 1
Views: 1456
Reputation: 41440
The [href$^="..."]
part is invalid selector.
You're looking for one of these, I think:
$('a[href^="/workorders/"]').addClass("boldnowrap");
$('a[href*="/workorders/"]').addClass("boldnowrap");
Beware that the second one will match everytime /workorders/
is found in your href
, what may not be what you want.
Upvotes: 3