how to refresh Select2 dropdown menu after ajax loading different content?

后端 未结 7 687
夕颜
夕颜 2020-12-08 19:42

I\'m using Select2 in a combination of dropdown menus. I have one menu for \"Countries\" and one for \"States/Provinces\". Depending on the country that is chosen, the \"Sta

7条回答
  •  伪装坚强ぢ
    2020-12-08 20:17

    Initialize again select2 by new id or class like below

    when the page load

    $(".mynames").select2();
    

    call again when came by ajax after success ajax function

    $(".names").select2();
    

提交回复
热议问题