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?
- How to change dropdown menu when time is changed ?
- How to Add Image into Dropdown List for each items ?
- How to fix number of visible items in HTML dropdown and allow multiple selections ?
- How to automatically close all collapsible elements inside of the accordion when closing the accordion?
- How to make a Bootstrap 4 accordion collapse when clicking the whole header div ?
- How to change the button color after clicking it using AngularJS ?
- How to remove arrow in dropdown in Bootstrap ?
- How to style a dropdown using CSS?
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.