Jason Statham
Jason Statham

Reputation: 130

jQuery select all anchors that have a certain class

I'm trying to access all anchors in the page that has a certain class using jQuery

For example. access all anchors that have class "bold"

I tried

$('.bold');

But I only need to select the anchors, can you please help me?

Thank you in advance

Upvotes: 2

Views: 2372

Answers (2)

j08691
j08691

Reputation: 207900

Wouldn't $('a.bold'); be what you need?

Upvotes: 2

Mohammad Anini
Mohammad Anini

Reputation: 5230

Use the following selector:

$('a.bold');

Upvotes: 8

Related Questions