Use parseFloat() to try to convert n to a number. Use !Number.isNaN() to check if num is a number.
Trigger an event
There are some special events that are avaialble as the method’s element.
Get all direct descendant elements that match a test
To do this, we need to combine Node.children with a few other techniques.
Check if all elements in an array are equal
Use Array.prototype.every() to check if all the elements of the array are the same as the first one.
Detect If an Element has focus
To detect if an element has the focus, you use the read-only property activeElement of the document object.
Upload files with ajax
This function sends selected files from a fileEle element to a back-end.
Sanitize an HTML string to reduce the risk of XSS attacks
Sanitizing is the process of removing any attributes, properties, and values that are not included in an allowlist or that are explicitly forbidden on a disallow list.
Open or close an element in fullscreen mode
Use Document.querySelector() and Element.requestFullscreen() to open the given element in fullscreen.
Check If the Document is Ready
To check if the document is ready and execute some code, you bind an event listener to the DOMContentLoaded event of the document object.
Wrap an element around a given element
Wrap the wrapper element around the ele element.