The default behavior of a dropdown menu is to close the menu list items when clicked inside. In this article, We will use stropPropagation method to prevent the dropdown menu from closing the menu list.
stopPropagation(): The stopPropagation() method is used to stop propagation of event calling i.e. the parent event is called we can stop the propagation of calling its children by using the stopProagration() method and vice-versa.
- Click Inside:
- Click Outside:
- How to display div elements using Dropdown Menu in jQuery?
- How to open dropdown menu on hover in Bootstrap ?
- jQuery UI | Menu
- How to create Radial Menu in CSS ?
- HTML | DOM Menu Object
- HTML Course | Creating Navigation Menu
- How to create Right Aligned Menu Links using HTML and CSS ?
- How to cover the whole screen when the hamburger menu is pressed on smaller screens?
- How to make a Bootstrap 4 accordion collapse when clicking the whole header div ?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.