当用户从下拉列表中选择一个选项时,显示的复选框将被替换为新复选框。
var chooser = '<select class="criteria" id="criteria">'
'<option value="One">One</option>' +
'<option value="Two">Two</option>' +
'</select>';
var criteriaSelect = '<div id="my-chooser-dialog" title="Chooser"> +
chooser + '</div>';
// criteriaChoices contains some checkboxes
if (jQuery("#my-chooser-dialog").dialog("isOpen") === true) {
jQuery("#my-chooser-dialog" > tr").remove();
jQuery("#my-chooser-dialog").append(criteriaChoices);
jQuery("#my-chooser-dialog").show();
return;
}
jQuery(criteriaSelect).dialog({modal: false, dialogClass: "my-chooser-dialog"});
jQuery("#my-chooser-dialog").append(criteriaChoices);