Reputation: 496
i want to change bootstrap label color when i select different label from dropdown. see plunker for more clarification http://embed.plnkr.co/lpQdSrVanpE7xq2IiqqB/
$(".dropdown-menu li a").click(function(){
$(this).parents(".dropdown").find('.label').html($(this).text() + ' <span class="caret"></span>');
$(this).parents(".dropdown").find('.label').val($(this).data('value'));
});
Upvotes: 3
Views: 358
Reputation: 2622
$(".dropdown-menu li a").click(function(){
$(this).parents(".dropdown").find('.label').html($(this).text() + ' <span class="caret"></span>').end().val($(this).data('value'));
$("#dropdownMenu1").removeAttr('class').addClass($(this).attr("class"));;
});
Upvotes: 1