Function: hasClass

hasClass(el, cls): boolean

Dom 操作,元素是包含某个 class

Parameters

Name Type Description
el null | HTMLElement HTML元素
cls string css类名

Returns

boolean

Since

1.1.5

Example

<div class="box flex"></div>
hasClass(document.querySelector('.box'), 'flex');
// => true
ON THIS PAGE