jQuery:选择器(带空格的类名) [英] jQuery: selector (classname with space)

查看:42
本文介绍了jQuery:选择器(带空格的类名)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试获取一个以面板当前"作为类名的 div.问题是空间 - 我该如何选择它?

解决方案

类名中不能有空格.你有两个类:

这个div有两个类:panel和current.这很容易选择:

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

这意味着选择所有具有类面板当前类的 div.

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

解决方案

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.

这篇关于jQuery:选择器(带空格的类名)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆