JavaScript Element Methods

You are Here:

JavaScript Element Methods

The following are the list of Element methods available in JavaScript programming.

FunctionsExplanation
addEventListener()Calls a function whenever the specified event occurs on the specified element.
attachShadow()Attaches a shadow DOM tree to the specified element and returns a reference to its ShadowRoot.
blur()Shifts the focus away from the specified element.
click()Triggers a click event on the specified element.
dispatchEvent()Dispatches the specified event to the current element.
focus()Requests to bring the focus to the specified element, if it can be focused.
getAttribute()Gets the value of the specified attribute of the specified element.
getAttributeNames()Gets the attribute names of the element as an Array of strings.
getBoundingClientRect()Returns the size of an element and its position relative to the viewport.
getClientRects()Returns a collection of DOMRect objects that indicate the bounding rectangles for each CSS border box in a client.
hasAttribute()Returns a Boolean value indicates whether the specified element has the specified attribute or not.
hasAttributes()Returns a Boolean value indicates whether the specified element has any attributes or not.
hasPointerCapture()Returns a Boolean value indicates whether the element does have pointer capture or not.
insertAdjacentElement()Inserts a the specified element into a specified position.
insertAdjacentHTML()Inserts a the specified html into a specified position.
insertAdjacentText()Inserts a the specified text into a specified position.
releasePointerCapture()Releases (stops) pointer capture that was previously set for a specific (PointerEvent) pointer by the element.setPointerCapture().
removeAttribute()Removes the attribute with the specified name from the specified element.
removeEventListener()Removes the specified event handler from the current element that was registered earlier with the element.addEventListener() method.
requestFullscreen()Opens an element in fullscreen mode.
requestPointerLock()Locks the mouse pointer on the specific element.
scrollIntoView()Scrolls the screen to a target element.
setAttribute()Sets the value of an attribute on the specified element.
setPointerCapture()Allows events for a particular pointer event to be re-targeted to a particular element instead of the normal target at a pointer's location.
toggleAttribute()Toggles the attribute on the given element.

Reminder

Hi Developers, we almost covered 97% of JavaScript Tutorials with examples for quick and easy learning.

We are working to cover every Single Concept in JavaScript.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author