更改select选项后,通过jQuery打开模式框

更改select选项后,通过jQuery打开模式框,jquery,Jquery,如何通过jQuery在更改选择选项时打开模型框 onchange = "$('#dialogboxname').dialog('open');" 添加如上所述的onchange属性^您可以为选择选项更改发送一个侦听器 在这里签出示例 html ​ 取决于您所说的“模态盒”(或问题中的“模型盒”)的含义 如果你说的是a,这应该可以做到: $(document).ready(function() { // Set the element as a dialog $('div#mo

如何通过jQuery在更改选择选项时打开模型框

onchange = "$('#dialogboxname').dialog('open');"

添加如上所述的onchange属性^

您可以为选择选项更改发送一个侦听器

在这里签出示例

html


取决于您所说的“模态盒”(或问题中的“模型盒”)的含义

如果你说的是a,这应该可以做到:

$(document).ready(function() {

    // Set the element as a dialog
    $('div#modalDialog').dialog({
        modal: true,
        autoOpen: false
    });

    // Set the dialog to open when mySelect changes
    $('select#mySelect').change(function() {
        $('#modalDialog').dialog('open');
    });

});
这将在加载DOM后,将id为“mySelect”的
元素的
div
元素配置为模态对话框,并在id为“mySelect”的
select
元素的
change
事件上设置侦听器以打开对话框

alert('ready');
$('#selectMe').change(function() {
    alert('Call modal function');
});
$(document).ready(function() {

    // Set the element as a dialog
    $('div#modalDialog').dialog({
        modal: true,
        autoOpen: false
    });

    // Set the dialog to open when mySelect changes
    $('select#mySelect').change(function() {
        $('#modalDialog').dialog('open');
    });

});