How do I stop a blur event?
Preventing the blur
If you want to prevent the blur event from being fired, you have to do so when you are inside the mousedown event, you can do so by invoking the method preventDefault() on the event. Click the checkbox, focus input & then click the button, the textfield never loses focus now.
How to focus and blur JavaScript?
Methods focus/blur
focus() and elem. blur() methods are used for setting/unsetting the focus on the element. It operates on all the browsers, except for Firefox (bug). If you enter something into the input and then try to apply Tab or click away from the <input> , and then onblur brings the focus back.
What is blur focus?
The blur event fires when an element has lost focus. The event does not bubble, but the related focusout event that follows does bubble. The opposite of blur is the focus event, which fires when the element has received focus. The blur event is not cancelable.