I'm trying to get a div which has "panel current" as classname. The problem is the space - how can I select it?
相关问题
- How to fix IE ClearType + jQuery opacity problem i
- jQuery add and remove delay
- What uses more memory in c++? An 2 ints or 2 funct
- Include empty value fields in jQuery .serialize()
- Disable Browser onUnload on certain links?
The
div
has twoclass
names:panel
current
You can use
$("div.panel")
or$("div.current")
to select it.Class names can't have spaces in them. What you have there is two classes:
This div has two classes: panel and current. That's easily selected:
That means select all divs that have class panel and class current.
panel current
is not a class name, actually it is two class names. You could use the following selector:OR
Use this if you need to match an element with an exact match of class names (including spaces)
The other posters are right, the DiV you posted has two class names: 'panel' and 'current'; If you want to select them both, use
$('.panel.current')
.This will also include elements like: