View Full Version : Jquery: Not Has Class

01-31-2009, 06:39 PM
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.

$("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. :)

02-01-2009, 08:56 AM
...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 ?

Bill Posters
02-01-2009, 10:36 AM

$("div .card:not(.correct)").eq(1).hide();

02-01-2009, 04:41 PM
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.

Bill Posters
02-01-2009, 05:26 PM
$("div .card:not(.correct)").eq(1).find('.question').hide();

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum