DOM HTMLElement.blur() Method
The blur() method removes keyboard focus from an element.
Description
The blur() method removes keyboard focus from the element, if it has it. Focus moves to the document body. It's rarely needed and can disorient keyboard users; moving focus to a sensible next element with focus() is usually better.
Removing focus also triggers the element's blur and focusout events, which are commonly used to validate a field once the user moves on. Calling blur() on an element that doesn't have focus does nothing.
Avoid using it to hide focus outlines after a click; the :focus-visible CSS pseudo-class lets you show focus styles only for keyboard users while keeping focus where it is, which is much better for accessibility.
Syntax
element.blur()Return Value
None (undefined).
Example
Browser Support
The following information will show you the current browser support for the HTMLElement.blur() method. Hover over a browser icon to see the version that first introduced support for this method.
Desktop





Tablets & Mobile





