- Source:
Id, class and attribute related functions
Methods
(static) addClass(el, …className)
- Source:
Add one or more classes to an element
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
el |
Element | ||
className |
String |
<repeatable> |
(static) getAttribute(el, attr) → {String}
- Source:
Get an attribute's value from an element
Parameters:
Name | Type | Description |
---|---|---|
el |
Element | |
attr |
String | The attribute's name |
Returns:
- Type
- String
(static) hasAttribute(el, attr) → {Bool}
- Source:
Check if an element has a given attribute
Parameters:
Name | Type | Description |
---|---|---|
el |
Element | |
attr |
String |
Returns:
- Type
- Bool
(static) hasClass(el, className) → {Bool}
- Source:
Check if an element has a given class
Parameters:
Name | Type | Description |
---|---|---|
el |
Element | |
className |
String |
Returns:
- Type
- Bool
(static) removeAttribute(el, attr)
- Source:
Remove an attribute from an element
Parameters:
Name | Type | Description |
---|---|---|
el |
Element | |
attr |
String | The attribute's name |
(static) removeClass(el, className)
- Source:
Remove a class from an element
Parameters:
Name | Type | Description |
---|---|---|
el |
Element | |
className |
String |
(static) setAttribute(el, attr, val)
- Source:
Add or set an attribute on an element
Parameters:
Name | Type | Description |
---|---|---|
el |
Element | |
attr |
String | The attribute's name |
val |
String | The attribute's value |
(static) toggleClass(el, className)
- Source:
Toggle a class on an element
Parameters:
Name | Type | Description |
---|---|---|
el |
Element | |
className |
String |