How to set selected value of jquery select2?

后端 未结 28 1346
野趣味
野趣味 2020-11-30 00:00

This belong to codes prior to select2 version 4

I have a simple code of select2 that get data from ajax



        
28条回答
  •  醉梦人生
    2020-11-30 00:49

    Sometimes, select2() will be loading firstly, and that makes the control not to show previously selected value correctly. Putting a delay for some seconds can resolve this problem.

    setTimeout(function(){                  
        $('#costcentreid').select2();               
    },3000);
    

提交回复
热议问题