How do you attach an event handler to a Bootstrap dropdown menu?

  • $('dropdown').click(function() {...})
  • $('dropdown').on('click', function() {...})
  • $('dropdown').addEventListener('click', function() {...})
  • $('dropdown').dropdown('toggle')
The correct answer is $('dropdown').on('click', function() {...}). This method is used to attach an event handler to a Bootstrap dropdown menu using jQuery. It allows you to define actions when the dropdown is clicked, providing a way to customize the dropdown's behavior.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *