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 open dropdown menu on hover in Bootstrap ?
- How to display div elements using Dropdown Menu in jQuery?
- HTML | DOM Menu Object
- How to create Radial Menu in CSS ?
- HTML Course | Creating Navigation Menu
- How to cover the whole screen when the hamburger menu is pressed on smaller screens?
- How to style a dropdown using CSS?
- How to clear all options in a dropdown box?
- How to remove arrow in dropdown in Bootstrap ?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.