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://codercto.com/courses/l/35.html

查看所有标签

Computers and Intractability

Computers and Intractability

M R Garey、D S Johnson / W. H. Freeman / 1979-4-26 / GBP 53.99

This book's introduction features a humorous story of a man with a line of people behind him, who explains to his boss, "I can't find an efficient algorithm, but neither can all these famous people." ......一起来看看 《Computers and Intractability》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码