xuwupiaomiao

html部分

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    <input class="inp" type="text" >
    <div id="box1">
        content
    </div>
</body>
</html>

  js部分

$(function(){
    /**
     * fn:显示/隐藏级联菜单
     */
    $(\'.inp\').click(function(){
        if($("#box1").css("display")=="none"){
            $("#box1").show();
            }else{
            $("#box1").hide();
            }
    });
    $(document).click(function(e){
        var target = $(e.target);
        if(target.closest(".inp").length != 0) return;
        $("#box1").hide()
        
    })
})

  

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-06-27
  • 2021-12-22
  • 2022-12-23
  • 2021-09-23
  • 2022-12-23
  • 2021-09-01
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-03-15
  • 2022-12-23
  • 2022-12-23
  • 2021-07-23
相关资源
相似解决方案