* * how does onclick realize that the drop-down menu on the right side of the screen appears after clicking the main menu on the right side of the screen? *

the effect you want to achieve is that when you click "View Baby by Category" on the right side of the picture, the drop-down menu appears on the right side of the screen. Currently, a drop-down menu appears when hovering, and you want to change it to appear after clicking. I tried the onclick event myself, but it didn"t work. Have the following questions:

  1. can you solve the problem with onclick alone?
  2. if you need to cooperate with javascript, how should you implement it in the most concise and practical js code? (try not to use jquery, but you can also use it if you can"t.)

I am not familiar with events such as onclick and javascript. I hope you can change the code and learn it by the way. Or give me a move. I hope your reply will become my motivation to learn js as soon as possible:)

Thank you!

here is the code:

</div>
</div>


</body>
</html>

you can't bear to look directly at this code.
you have a relationship between showing and hiding. Click on the show drop-down box and click on the hidden drop-down box next to it. This is not very clear.

  

Hello, added this code, but there was no response after clicking!

Menu