You can unfocus an element in JavaScript by triggering the blur()
method on the element. Here's an example:
61 chars3 lines
In this example, the blur()
method is triggered on an input
element, causing it to lose focus. You can use this method on any HTML element that can be focused (such as input fields, buttons, and links) to remove focus from that element.
gistlibby LogSnag