jquery制服没有造型ajax负载元素

时间:2013-12-07 19:49:36

标签: jquery ajax uniform

我正在使用jquery将远程页面加载到页面中。远程页面包含一些由于ajax加载而不再设置样式的选择和输入。根据我的发现,我需要再次指定并更新,但以下内容无效。

// load the page into div
$('#show_comps').load('/process/show_comps.php');

// correct the uniform styling
$.uniform('select, input');
$.uniform.update();

编辑:

$('#show_comps').load('/process/show_comps.php',
    function() {
        $('#show_comps').find('select').uniform(),
        $('#show_comps').find('input:checkbox').uniform()
    }
)

这更正了页面上的复选框,但是下拉列表仍然无效(它改变了样式,但不正确)。

<select class="form-control input-medium select2me pull-right" onChange="App.scrollTo($(this.value), -60)" data-placeholder="Jump to computer...">
    <option value=""></option>
    ...and so on

第二次编辑:

下拉列表使用的是select2插件。这就是我最终得到的结果。

$('#show_comps').load('/process/show_comps.php',
    function() {
        $('#show_comps').find('input').uniform();
        $('#comp_selection select').select2();
    }
)

1 个答案:

答案 0 :(得分:0)

在ajax调用之后,数据出现后使用此

$(”。elementClass中)均匀();