Change value of materialize select box by jquery

前端 未结 11 1598
滥情空心
滥情空心 2020-12-29 22:18

I want to change materialize select box value by jquery.

I am using $(\'#myselect\').val(\'1\'); on onchange event of other select box but

11条回答
  •  抹茶落季
    2020-12-29 22:56

    This is similar to what logikal answered but I think is cleaner:

    $(".your-component-class").change(function(){
    
       //your code..
    
    
       //re-initialize component
       $(this).material_select();    
    });
    

提交回复
热议问题