jquery - Trigger an action when selecting on one of the option of dropdown-menu -


i have dropdown-menu

enter image description here

i want trigger when selecting on 1 of option. i've tried

$.each(objects.assignments, function(index, value) {     $('#group-' + index).click(function() {         updateinfo(index);         chart.draw(data[index], options);         if ( index == 0 ){           $("#as-dd.dropdown").text('summary');           console.log("a");         }         else{           $("#as-dd.dropdown").text('group ' + index);            console.log("b");         }     }); }); 

  • i got no error in console.
  • i got nothing display in console.

how trigger when selecting on 1 of option ?

am not suppose use .click() ?

any helps / suggestions on appreciated.

you not need .each() or .click(). use .change() method

$('select').on('change', function(){   var selectedvalue = $(this).val();   // based on selectedvalue can }); 

Comments