IT story

jQuery 언 포커스 방법이 있습니까?

hot-time 2020. 5. 15. 08:04
반응형

jQuery 언 포커스 방법이 있습니까?


텍스트 영역이나 입력의 초점을 해제하려면 어떻게해야합니까? $('#my-textarea').unfocus();방법을 찾을 수 없습니까?


$('#textarea').blur()

http://api.jquery.com/blur/의 설명서


귀하의 질문에 따르면, 대답은 이벤트를 설정하는 것뿐만 아니라 흐림유발하는 방법입니다 .

 $('#textArea').trigger('blur');

당신이 찾고있는 것 같아 .focusout()


이것은 나를 위해 작동합니다 :

// 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) {}
});

그래서 당신은 이것을 할 수 있습니다

$('#textarea').attr('enable',false)

그것을 시도하고 피드백을 제공

참고 URL : https://stackoverflow.com/questions/857245/is-there-a-jquery-unfocus-method

반응형