如何用jquery动态的创建select2

如何用jquery动态的创建select2

问题描述:

我现在是这么写的,但是无法动态创建

谁知道如何动态创建select2

    function a(){
        var html = '<select class="js-example-basic-single">'+
        '  <option value="AL">Alabama</option>'+
        '  <option value="WY">Wyoming</option>'+
        '</select>';
        $('.context_tool_right').html(html);
    }

 $('.context_tool_right').html(html).find('select').select2();