首页 > 编程知识 正文

js nextSibling函数,js中map函数用法

时间:2023-05-03 05:10:48 阅读:218646 作者:4011

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<title>菜鸟教程(runoob.com)</title> 
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
</script>
</head>
<body>

<p>返回相邻的同胞元素</p>
<div class="query-set" οnclick="rptOpenSelectWindow(this)">
        第一个  <i class="icon-caret-down"/>
  </div>
<div class="query-field" style="background-color:red">
      第二个 <ul id="rpt_setting_2"/>
</div>

<script>
 function rptOpenSelectWindow(_this) {
                var w = _this.nextSibling;
                if (w.style.display != 'block') {
                    w.style.display = 'block';
                } else {
                    w.style.display = 'none';
                }
        }
</script>
</body>
</html>

点击第一个会显示 或者隐藏

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。