js搜索显示搜索结果div,点击除了搜索框和搜索结果div时,隐藏

83510998 2015-08-18

jQuery(document).bind('click',function(e){
  var target = jQuery(e.target);
  if(target.closest(".seaVal").length!=1&&target.closest(".seaList").length!=1)
  {
   var showcityaz = document.getElementById("showcityaz");
   if($(".seaList").show()){
    $(".seaList").hide();
   }
  }
 }
 );

<div class="seaVal"><input id="subjectName" name="subjectName" type="text" onkeyup="doQuerySubject(this)" onfocus="doQuerySubject(this)"  /></div>

<div class="seaList"></div>

相关推荐

84483368 / 0评论 2013-11-22

chengxiaofeng / 0评论 2019-04-24