Is there a way to dynamically ajax add elements through jquery chosen plugin?

后端 未结 8 1615
南旧
南旧 2020-12-15 06:50

I am trying to use \"Chosen\" plugin by harvest (http://harvesthq.github.com/chosen/) and it works for the static set of options I am passing. However, what I want is that w

8条回答
  •  佛祖请我去吃肉
    2020-12-15 07:18

    in your ajax response, try

    var newOption = new Option("Text", __value__);  
    $("#tagSelection").append(newOption);  
    **/*  add this line */  
    $("#tagSelection").val(__value__);**  
    $("#tagSelection").trigger("liszt:updated");  
    

提交回复
热议问题