Is there a jQuery unfocus method?

Is there a jQuery unfocus method?

How can I unfocus a textarea or input? I couldn’t find a $(‘#my-textarea’).unfocus(); method?


Solution 1:


Documentation at:

Solution 2:

Based on your question, I believe the answer is how to trigger a blur, not just (or even) set the event:


Solution 3:

Guess you are looking for .focusout()

Solution 4:

This works for me:

// Document click blurer
$(document).on('mousedown', '*:not(input,textarea)', function() {
    try {
        var $a = $(document.activeElement).prop("disabled", true);
        setTimeout(function() {
            $a.prop("disabled", false);
    } catch (ex) {}

Solution 5:

So you can do this


try it and give feedback

Related:  Pure css close button