当我点击选择框中的某个选项时,我可以打开一个对话框但是当我尝试打开第二个选项时,第一个关闭。无法弄清楚它为什么会关闭。任何帮助都会被追上。
// Builds list of tests in the update dialog
function loadTests(testList) {
// Creates dropdown with list of active reports
$(testList).find('test').each(function(index, element) {
var id = $(this).find('id').text();
var name = $(this).find('name').text();
console.log(id + ':' + name);
//START: Reports Menu
$("#reports").append(
'<option id="' + id + '" value="' + name + '">' + name + '</option>'
)
});
$( document ).on("change", "#reports", function(){
var id = $(this).find("option:selected").attr("id");
var name = $(this).val();
console.log(id + ':' + name);
var options = {
id: id,
title: name,
height: 800,
width: 600,
show: {
effect: "slideDown",
duration: 800
},
minWidth: 100,
minHeight: 100,
resizable: true
}
$("#dialog-wrapper").dialog(options).dialog("open").append(
'<div></div>'
)
})
}