Creates an instance of Element.
The native HTML element.
Gets the native HTML element.
The native HTML element.
Adds a class to the element.
The class name to add.
Adds an event listener to the element.
The event type to listen for.
The event handler function.
Optional
once: booleanWhether the event should only fire once.
A function to remove the event listener, or undefined if the element is not suitable for events.
Inserts HTML after the element.
The HTML to insert.
Gets the value of an attribute.
The attribute name.
The value of the attribute or null if not found.
Adds a blur event listener to the element.
The event handler function.
Optional
once: booleanWhether the event should only fire once.
A function to remove the event listener.
Finds all elements with the specified class name within this element's scope.
The class name to match.
An array of Element instances.
Finds an element by its ID within this element's scope.
The ID of the element to find.
The Element instance if found, null otherwise.
Finds the first element matching the CSS selector within this element's scope.
The CSS selector to match.
The Element instance if found, null otherwise.
Finds all elements matching the CSS selector within this element's scope.
The CSS selector to match.
An array of Element instances.
Finds all elements with the specified tag name within this element's scope.
The tag name to match.
An array of Element instances.
Adds a change event listener to the element.
The event handler function.
Optional
once: booleanWhether the event should only fire once.
A function to remove the event listener.
Adds a click event listener to the element.
The event handler function.
Optional
once: booleanWhether the event should only fire once.
A function to remove the event listener.
Gets the value of a data attribute.
The data attribute name.
The value of the data attribute.
Clears the inner content of element by setting it to an empty string.
Adds a focus event listener to the element.
The event handler function.
Optional
once: booleanWhether the event should only fire once.
A function to remove the event listener.
Checks if the element has a specific class.
The class name to check.
True if the element has the class, false otherwise.
Adds a keydown event listener to the element.
The keyboard event handler function.
Optional
once: booleanWhether the event should only fire once.
A function to remove the event listener.
Adds a keyup event listener to the element.
The keyboard event handler function.
Optional
once: booleanWhether the event should only fire once.
A function to remove the event listener.
Gets the closest ancestor element that matches the selector.
The selector to match.
The closest ancestor element.
Removes the element from the DOM.
Removes a specific class from the element.
The class name to remove.
Gets or sets the value of the input element.
Optional
value: stringOptional value to set for the input element. If no value is provided, it returns the current value of the input element. If a value is provided, it sets the input element's value to that value. This method is useful for both getting and setting the value of input elements.
The value of the input element.
Checks if the element is visible.
True if the element is visible, false otherwise.
Static
byFinds all elements with the specified class name. When called as static method: searches entire document. When called as instance method: searches within this element's scope.
The class name to match.
An array of Element instances.
Static
byFinds an element by its ID. When called as static method: searches entire document. When called as instance method: searches within this element's scope.
The ID of the element to find.
The Element instance if found, null otherwise.
Static
byFinds the first element matching the CSS selector. When called as static method: searches entire document. When called as instance method: searches within this element's scope.
The CSS selector to match.
The Element instance if found, null otherwise.
Static
byFinds all elements matching the CSS selector. When called as static method: searches entire document. When called as instance method: searches within this element's scope.
The CSS selector to match.
An array of Element instances.
Static
byFinds all elements with the specified tag name. When called as static method: searches entire document. When called as instance method: searches within this element's scope.
The tag name to match.
An array of Element instances.
Class representing a generic DOM element with utility methods for manipulation and validation.