首页 > web前端 > js教程 > 正文

JQuery 中几个类选择器的简单使用介绍_jquery

WBOY
发布: 2016-05-16 17:40:38
原创
1018 人浏览过
复制代码 代码如下:













This is the first div


This is the second div



This is the first span



This is the first span + eric sun class.




This is the eric sun class.










复制代码 代码如下:

$(".first_div, .first_span")

将包含有.first_div 或者 .first_span" 的对象都取到。 这里取到 4 个 对象。
此处的Html对应
复制代码 代码如下:


This is the first div



This is the first span



This is the first span + eric sun class.


复制代码 代码如下:

$(".first_div .first_span")

将以 .first_div 为类的控件 下的 以 .first_span 为类 的对象取到(类与类之间带有空格 逐层取)。 这里只取到 1 个。
对应的 className="first_span" 此处的Html对应
复制代码 代码如下:



This is the first span



复制代码 代码如下:

$(".first_span.eric_sun_class")

将包含有.first_span 并且同时包含有 .eric_sun_class 类的 对象取到(类与类之间没有空格 类似于 ‘与' 操作)。 这里只取到1个。
对应的 className="first_span eric_sun_class" 此处的Html 对应
复制代码 代码如下:


This is the first span + eric sun class.

相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!