Use Element.classList and DOMTokenList.contains() to check if the element has the specified class. Source https://www.30secondsofcode.org/js/s/has-class
Retrieve the value of a CSS rule for the specified element
Use Window.getComputedStyle() to get the value of the CSS rule for the specified element.
Remove a class from HTML element
Use Element.classList and DOMTokenList.remove() to remove the specified class from the element.
Toggle a class for an HTML element
toggleClass toggles a class for an HTML element.
Create a custom scrollbar
You can customize the look and feel of the browser’s scrollbar by changing some CSS properties.
Resize the width of a text box to fit its content automatically
To adjust its width based on its content dynamically, we create a fake element whose content is the same as the input value.
Check if an element has an attribute
Check for the existence of an attribute (including data attributes) on an element. This method can also be used to manipulate other types of attributes—things like id, tabindex, name, and so on.
Get the computed style of an element
Get the actual computed style of an element. This factors in browser default stylesheets as well as external styles you’ve specified.
Get and set inline styles for an element
Get a style, and then if this style is not set as an inline style directly on the element, it returns an empty string.
The following function returns the default value of CSS property for given tagName.