Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 26, 2013 05:32 PM by Chintalas
Member
310 Points
340 Posts
Jan 26, 2013 10:43 AM|LINK
I tried this to remove all class 'apple' that is inside class 'Fruit' but no success. Please advise:
Tried the following:
$('.Fruit:input').removeClass('apple'); $('.Fruit input[type="text"]').removeClass('apple'); $('.Fruit:input[type="text"]').removeClass('apple'); <div class="Fruit"> <div class="apple"></div> <div class="apple"></div> <div>
All-Star
27716 Points
4574 Posts
Jan 26, 2013 02:42 PM|LINK
Try using the following :
$('.Fruit .apple').removeClass('apple');
This will select all elements with the class apple (denoted by .apple) within any parent elements with the class Fruit (denoted by .Fruit)
Here's an example of it.
40 Points
16 Posts
Jan 26, 2013 05:32 PM|LINK
Since you have mentioned both of them has classes u need to keep . as prefix so use ".apple" to get it done
k80sg
Member
310 Points
340 Posts
Jquery removing class from all child element
Jan 26, 2013 10:43 AM|LINK
I tried this to remove all class 'apple' that is inside class 'Fruit' but no success. Please advise:
Tried the following:
$('.Fruit:input').removeClass('apple'); $('.Fruit input[type="text"]').removeClass('apple'); $('.Fruit:input[type="text"]').removeClass('apple'); <div class="Fruit"> <div class="apple"></div> <div class="apple"></div> <div>Rion William...
All-Star
27716 Points
4574 Posts
Re: Jquery removing class from all child element
Jan 26, 2013 02:42 PM|LINK
Try using the following :
$('.Fruit .apple').removeClass('apple');This will select all elements with the class apple (denoted by .apple) within any parent elements with the class Fruit (denoted by .Fruit)
Here's an example of it.
Chintalas
Member
40 Points
16 Posts
Re: Jquery removing class from all child element
Jan 26, 2013 05:32 PM|LINK
Since you have mentioned both of them has classes u need to keep . as prefix so use ".apple" to get it done