ios端点击document,input框不会失去焦点

<body>
<input type="text" value="ios端点击document,input框不会失去焦点">
<input class="input" type="text" value="已hack,点击document可失去焦点">
<script>
window.onload = function() {
document.querySelector('body').addEventListener('touchend', function(e) {
if(e.target.className != 'input') {
document.querySelector('.input').blur();
}
});

}
</script>
</body>

原文地址:https://www.cnblogs.com/wssdx/p/8086550.html