Click the first-level menu to expand the second-level menu

< div class= "content" >

<ul>
  <li><a></a>
    <ul>
      <li><a href="-sharp"></a></li>
      <li><a href="-sharp"></a></li>
    </ul>
  </li>
</ul>

< / div >

want to hide all orders and outstanding orders at the beginning of the page, then click on the order, expand all orders and outstanding orders below, and open the default secondary menu (all orders).
$(function () {

      $(".content li").click(
          function() {
              $(this).find("ul").show();
          },function(){
              $(this).find("ul").hide();
          },
      );
  });
  
Apr.05,2021

haven't used Jquery for a long time, and when can the first parameter of click be passed to the method? All your logic should be in one function


I'll give you an example that I often use. Cite your own examples.

<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <title></title>
    <meta name="keywords" content="" />
    <meta name="description" content="" />
    <link rel="stylesheet" type="text/css" href="" />
    <script type="text/javascript" src="JS"></script>
    <style type="text/css">
        div{width:400px; height:300px; background-color:gray;font-size: 40px;}

    </style>
    <script type="text/javascript"></script>
    <script type="text/javascript">

    </script>
</head>

<body>
<div style="display:block" id="k1">
    1
</div>

<div  style="display:none;background-color:blue"  id="k2">
    2
</div >

<div style="display:none; background-color:red"  id="k3">
    3
</div>

<a href="javaScript:fun('k1');">1</a> | <a href="javaScript:return false" onclick="fun('k2')">2</a> | <a href="javaScript:fun('k3')">3</a>

<script type="text/javascript"> function fun(idName){ var obj = document.getElementById(idName); var divObjs = document.getElementsByTagName("div"); for(i in divObjs){ if(divObjs[i]==obj) divObjs[i].style.display="block"; else divObjs[i].style.display='none'; } } </script> </body> </html>
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3c260-3469e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3c260-3469e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?