Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-31-2009, 06:39 PM   PM User | #1
mberkom
New Coder

 
Join Date: May 2008
Posts: 17
Thanks: 1
Thanked 0 Times in 0 Posts
mberkom is an unknown quantity at this point
Exclamation Jquery: Not Has Class

I've got a jquery selector I'm trying to get done and since I'm somewhat new to jquery I'm stumped. Essentially. I'm trying to get a div within divs with the class "card" that do not have the class of "correct" and then select the first one out of the list.

Code:
$("div .card:not(.correct):nth-child("1") .question ").css('display', 'none');
After spending quite a while trying to get this to work I am now opening it up to anyone to give me a hand.
mberkom is offline   Reply With Quote
Old 02-01-2009, 08:56 AM   PM User | #2
rangana
Senior Coder

 
rangana's Avatar
 
Join Date: Feb 2008
Location: Cebu City, Philippines
Posts: 1,752
Thanks: 65
Thanked 372 Times in 365 Posts
rangana will become famous soon enoughrangana will become famous soon enough
Quote:
Originally Posted by mberkom View Post
...and then select the first one out of the list.

Which one? Selects the first div? Selects the first "correct" div? Selects the first element of "card" div ?
__________________
Learn how to javascript at 02geek

The more you learn, the more you'll realize there's much more to learn
Ray.ph
rangana is offline   Reply With Quote
Old 02-01-2009, 10:36 AM   PM User | #3
Bill Posters
Senior Coder

 
Join Date: Feb 2003
Posts: 1,665
Thanks: 0
Thanked 27 Times in 25 Posts
Bill Posters will become famous soon enough
Try…
Code:
$("div .card:not(.correct)").eq(1).hide();
Bill Posters is offline   Reply With Quote
Old 02-01-2009, 04:41 PM   PM User | #4
mberkom
New Coder

 
Join Date: May 2008
Posts: 17
Thanks: 1
Thanked 0 Times in 0 Posts
mberkom is an unknown quantity at this point
Rangana, I am trying to select the paragraph .question in the first div with the class of .card and without the class of .correct. Does that help? Please ignore the quotes in nth-child. They were a mistake thats not in the real code.

Bill Posters, I think you have almost solved my problem however your code does not take into account the selection of the .question paragraph. When I get a chance, I'll play around with your code and see if I can get it to work.
mberkom is offline   Reply With Quote
Old 02-01-2009, 05:26 PM   PM User | #5
Bill Posters
Senior Coder

 
Join Date: Feb 2003
Posts: 1,665
Thanks: 0
Thanked 27 Times in 25 Posts
Bill Posters will become famous soon enough
Code:
$("div .card:not(.correct)").eq(1).find('.question').hide();
Bill Posters is offline   Reply With Quote
Reply

Bookmarks

Tags
jquery, not has class

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:18 AM.


Advertisement
Log in to turn off these ads.