Semantic UI dropdown change handler

后端 未结 3 1319
野的像风
野的像风 2020-12-23 18:19

I have the following dropdown using Semantic UI:


                      
相关标签:
3条回答
  • 2020-12-23 19:12

    It seems that onChange setting can be added when creating the dropdown:

    $(".select-language").dropdown({
        onChange: function (val) {
            alert(val);
        }
    });
    

    JSFIDDLE

    0 讨论(0)
  • 2020-12-23 19:16

    Actually, there are three ways to bind the event:

    // globally inherited on init
    $.fn.dropdown.onChange = function(){...};
    
    // during init
    $('.myDropdown').dropdown({
     onChange: function() {...}
    });
    
    // after init
    $('.myDropdown').dropdown('setting', 'onChange', function(){...});
    
    0 讨论(0)
  • 2020-12-23 19:17
        jQuery('.ui.ekstensi.fluid.dropdown').dropdown('setting','onAdd',function (val,text,choice) {
    
        alert(choice);
        }).dropdown('setting','onRemove',function (removedValue, removedText, removedChoice) {
        //your action here
        alert(removedValue);
    
        });
    

    JSFIDDLE

    0 讨论(0)
提交回复
热议问题