Shpigford
Shpigford

Reputation: 25378

jQuery removeClass based on ID?

So right now I'm doing this:

$(".radio_visible").hide().removeClass("radio_visible");

But what I'd like to be able to do is remove all of the radio_visible classes if it's within a specific ID. Sort of like this:

$(".radio_visible").hide().removeClass("#payment_fields .radio_visible");

So is there another jQuery function I should be looking at to pull that off?

Upvotes: 0

Views: 3454

Answers (2)

Pointy
Pointy

Reputation: 414086

Maybe

$('#payment_fields *.radio_visible').hide().removeClass('radio_visible');

Upvotes: 0

Chris Van Opstal
Chris Van Opstal

Reputation: 37587

You could do:

$("#payment_fields .radio_visible").hide().removeClass("radio_visible");

Upvotes: 8

Related Questions