如何取消文本区域或输入的焦点?我找不到$('#my-textarea').unfocus();方法?
当前回答
根据你的问题,我相信答案是如何触发模糊,而不仅仅是(甚至)设置事件:
$('#textArea').trigger('blur');
其他回答
这对我来说很管用:
// 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').trigger('blur');
我喜欢下面的方法,因为它适用于所有情况:
$(':focus').blur();
所以你可以这样做
$('#textarea').attr('enable',false)
尝试一下并给出反馈
我猜你在找。focusout()