Working example: http://jsfiddle.net/enzDx/5/
The only change I made to your HTML was to wrap the text "Select" with span
tags with the element ID dropdown_title
so it was easier to update.
JavaScript:
$('.dropdown-toggle').dropdown();
$('#divNewNotifications li').on('click', function() {
$('#dropdown_title').html($(this).find('a').html());
});?
Basically all I'm doing is whenever the user clicks on a list item, I update the drop-down title text with the text of the link contained in the last item.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…