jQuery hasClass() 方法

jQuery 教程 · 2019-03-27 13:27:06

实例

检查 <p> 元素是否包含 "intro" 类:

$("button").click(function(){ alert($("p").hasClass("intro")); });

定义和用法

hasClass() 方法检查被选元素是否包含指定的类名称。

如果被选元素包含指定的类,该方法返回 "true"。

语法

$(selector).hasClass(classname)

参数 描述
classname 必需。规定需要在被选元素中查找的类。

点击查看所有 jQuery 教程 文章: https://www.codercto.com/courses/l/35.html

查看所有标签

The Intersectional Internet

The Intersectional Internet

Safiya Umoja Noble、Brendesha M. Tynes / Peter Lang Publishing / 2016

From race, sex, class, and culture, the multidisciplinary field of Internet studies needs theoretical and methodological approaches that allow us to question the organization of social relations that ......一起来看看 《The Intersectional Internet》 这本书的介绍吧!

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具