473,387 Members | 3,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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.

Expand|Select|Wrap|Line Numbers
  1. $("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.
Feb 1 '09 #1
3 12523
acoder
16,027 Expert Mod 8TB
Get rid of the quotes in nth-child or use first-child.
Feb 1 '09 #2
I'm afraid thats not the problem. The quotes are there because I forgot to get rid of them. When I implemented the code the quotes were there so I could put a variable in like this:
Expand|Select|Wrap|Line Numbers
  1. "+variable+"
So the actual code is this:
Expand|Select|Wrap|Line Numbers
  1. $("div .card:nth-child("+currentCard+")").addClass("correct").removeClass("incorrect");
The currentCard variable is equal to 1.
Feb 1 '09 #3
acoder
16,027 Expert Mod 8TB
If I've understood correctly, you want a div within divs, so you'd be looking for something like:
Expand|Select|Wrap|Line Numbers
  1. $("div.card div:not(.correct):nth-child(1)")
If that's not quite what you're after, post the HTML code too.
Feb 1 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: mikeh3275 | last post by:
I'm new to developing in jQuery, so I'm probably doing this wrong. I'm loading a form into a modal dialog box and I'm trying to assign a click event to the button in the form, but I can't seem to...
83
by: liketofindoutwhy | last post by:
I am learning more and more Prototype and Script.aculo.us and got the Bungee book... and wonder if I should get some books on jQuery (jQuery in Action, and Learning jQuery) and start learning about...
3
by: NetWave | last post by:
Hi, For my next project I'm going to need Ajax, so I'm in about to read some books on ASP.NET Ajax. While reading Rick Strahl's blog I stumbled upon jQuery. I've been to the website and seen...
1
by: somnamblst | last post by:
This function swaps images between a close & replay GIF. Line 12 has a speed of 1 second specified for the slideDown, but no speed specified for the slideUp so it is defaulting to normal. I tried...
26
by: RobG | last post by:
Do some of the regulars here need to re-think their (sometimes strident) opposition to libraries? Both Microsoft and Nokia have announced support for jQuery. It seems to have gained quite a bit...
2
by: souporpower | last post by:
Hi All I am trying to print some HTML using JQUERY. I am posting the code. I don't see the alert. It seems as though the function is not registered when the document is loaded. Can someone...
53
by: souporpower | last post by:
Hello All I am trying to activate a link using Jquery. Here is my code; <html> <head> <script type="text/javascript" src="../../resources/js/ jquery-1.2.6.js"</script> <script...
3
by: Reveller | last post by:
I'm rewriting my own js library to jquery functions. A huge undertaking, but hopefully worth it in the future :) Question: why does the script always return 0 for img_width? Logo.gif exists and...
4
by: pavanip | last post by:
Hi, I want to popup aspx page using jquery. I have written the following code <a href="Contactus.aspx?TB_iframe=true&height=250&width=200" class="thickbox" >AboutUs</a> I have called...
5
by: jrod11 | last post by:
hi, I found a jquery html table sorting code i have implemented. I am trying to figure out how to edit how many colums there are, but every time i remove code that I think controls how many colums...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.