soundasleep / jquery-dropdown

Bootstrap-style dropdowns with some added features and no dependencies.
Other
767 stars 266 forks source link

drop down not working when we redraw the list #37

Closed marcucio closed 11 years ago

marcucio commented 11 years ago

I have the following list that works when I first load it. I then dynamically have to recreate the list again (using jquery html function) and now the list will not work, nothing happens when I click the trigger. I have tried to reattach the dropdown but it does not work:

$('#effort_value').dropdown('attach', '#effort_container');

any help would be appreciated, thanks

<div id="effort_value" data-dropdown="#effort_container" class="value">none</div> 
<div id="effort_container" class="dropdown">
<ul class="dropdown-menu">
<li><a id="0" class="dropdown_item" href="#">none</a></li>
<li><a id=".25" class="dropdown_item" href="#">1/4 day</a></li>
<li><a id=".5" class="dropdown_item" href="#">1/2 day</a></li>
<li><a id="1" class="dropdown_item" href="#">1 day</a></li>
</ul>
</div>
claviska commented 11 years ago

Try replacing only the contents of the ul.dropdown-menu.

marcucio commented 11 years ago

I need to rebuild the entire dialog so this wouldn't work. I cleared the html of the entire dialog then rebuilt it and this seemed to fix the issue.

Thanks for the help