Click here to Skip to main content
15,895,799 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am having an issue with jQuery that I need some advice on. I can't figure out what I'm doing wrong.

Here is the scenario:

I have a dropdownbox that was created with jQuery Bootstrap code. It uses the slideToggle to slide the menu down. That is working fine when the dropdown is clicked. The issue I'm having is trying to get it to slide back up when an element is clicked within the menu.

Here is what I have so far to slide the menu back up.

JavaScript
$(document).on('click', '.dropdown-menu li a', function ()
{
    $(this).next('.dropdown-menu').slideUp(500);
}


It currently does nothing when a menu element is selected.

Am I missing something obvious?

Thanks everyone!
Posted
Comments
Debug and see whether it is going inside the event or not.
karthik Udhayakumar 25-Jan-14 9:50am    
Hello,
You can find the solution for your query here
http://stackoverflow.com/questions/15979359/how-to-get-selected-element-in-bootstrap-dropdown-where-dropdown-is-dynamically

All the best:)

1 solution

I figured it out myself. It had to do with the ID of the element and the event I was checking for.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900