ch3t
ch3t

Reputation: 496

add bootstrap label class from selected drop down list

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

Answers (1)

Anil  Panwar
Anil Panwar

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

Related Questions