Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
653 views
in Technique[技术] by (71.8m points)

class - jQuery: selector (classname with space)

I'm trying to get a div which has "panel current" as classname. The problem is the space - how can I select it?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Class names can't have spaces in them. What you have there is two classes:

<div class="panel current">

This div has two classes: panel and current. That's easily selected:

$("div.panel.current")...

That means select all divs that have class panel and class current.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...