我会继续尝试类似帖子的不同建议。从公司选择中选择公司后,无法在收件人选择上重新应用Javascript功能。 HTML:
<div id="recipient-container" class="formRightMM noSearch">
<select id ="outgoingRecipient" class="chzn-select">
//options loaded depending on company chosen
</select>
</div>
在文档加载时,从 custom.js
中选择.uniform()应用的样式$(function() {
$("select, input:checkbox, input:radio, input:file").uniform();
}
收件人HTML风格化
<div id="recipient-container" class="formRightMM noSearch">
<div id="uniform-outgoingRecipient" class="selector">
<span style="-moz-user-select: none;">Choose a Recipient</span>
<select id="outgoingRecipient" class="chzn-select required chzn-done" style="display: none; opacity: 0;">
//after company selected, ajax updates options
<option value="827">Big Dog</option>
<option value="828">Bob</option>
</select>
</div>
<div id="outgoingRecipient_chzn" class="chzn-container chzn-container-single chzn-container-active" style="width: 139px;">
<a class="chzn-single" href="javascript:void(0)" tabindex="-1">
<span>Choose a Recipient</span>
</a>
<div class="chzn-drop" style="left: -9000px; width: 137px; top: 27px;">
//but options should be stylized here by .uniform();
<ul class="chzn-results"></ul>
</div>
AJAX plus.js 文件
$(document).ready(function() {
function get_recipient(){
return $.ajax({
type: "POST",
url: "get_recipient.php",
data: companyIDDataString,
dataType: 'html',
success: function(result){
$('#outgoingRecipient').html(result);
}
//etc...
选择公司时<options>
会更新,但.uniform()
应用的样式不会更新<ul>
元素。尝试了在成功中应用.uniform()
调用的不同方法。插件添加了新的HTML,但我不确定我使用.uniform()
定位的是什么。尝试(#outgoingRecipient).uniform()
和其他一些元素ID,没有结果。我是否需要将插件作为整体应用于文档?有人给我一个暗示吗?
答案 0 :(得分:1)
构建select后,请尝试重新运行js脚本。假设您将统一插件脚本放在uniform.js中:
$(document).ready(function(){
//your ajax call
$.getScript("uniform.js");
});