您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

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

2025/11/9 9:52:32发布18次查看
复制代码 代码如下:
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.
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product