level 14

需要注意的是一定要监听 touchend事件,ios不支持监听click事件,上面的代码的意思是,监听body的touchend事件,如过被touchend的不是输入框,则不触发search方法,search方法的意思是,有一个隐藏域,和输入框,当隐藏域的内容跟输入框的内容不一致时再真正的进行搜索操作window.onload = function () {
document.querySelector('body').addEventListener('touchend', function (e) {
if (e.target.className != "search_area") {
console.log("点击了body");
search();
}
});
}
function search() {
console.log("开始查找");
if ($(".search_area").val() != "" && $(".search_area").val() != null && $(".search_area").val() != undefined) {
if ($("#beiyong").val() != $(".search_area").val()) {
document.getElementById('search_form').submit();
}
}
}

