문제

I am using below code for iPad. But though an error message in IE 'Object not supported (addEventListener)'

function isTextInput(node) {
    return ['INPUT', 'TEXTAREA'].indexOf(node.nodeName) !== -1;
}
document.addEventListener('touchstart', function(e) { 
    if (!isTextInput(e.target) && isTextInput(document.activeElement)) {
    //document.activeElement.blur();
    $('input').blur();
}
}, false);
도움이 되었습니까?

해결책

The error is because addEventListener is supported only in IE9+, either you need to use attachEvent() or since you have jQuery use it

$(document).on('touchstart', function (e) {
    if (!isTextInput(e.target) && isTextInput(document.activeElement)) {
        //document.activeElement.blur();
        $('input').blur();
    }
});
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top