jquery插件不适用于模态窗口内的元素

时间:2014-03-21 19:26:31

标签: jquery jquery-plugins jquery-chosen

我正在使用chosen-select插件来获取更多<select>它在主页面内正常工作,但是当我在UIKit提供的模态窗口中使用它时,它不起作用。 这是代码:

初始化插件:

$(document).ready(function(){
var config = {
        '.chosen-select': {},
        '.chosen-select-no-results': { no_results_text: 'nothing found!' }
    }
    for (var selector in config) {
        $(selector).chosen(config[selector]);
    }
});

每个<select>类的.chosen-select都会受到插件的影响。

以下是完整的代码:http://jsfiddle.net/maysamsh/xFv4W/8/

1 个答案:

答案 0 :(得分:0)

删除.chosen-select类并在加载模式后应用.chosen()修复它。 这是代码http://jsfiddle.net/maysamsh/xFv4W/13/