jQuery UI对话框 - dialog()不是一个函数

时间:2016-07-29 09:53:55

标签: javascript html tabs alertdialog jquery-ui-dialog

我正在尝试使用多输入提示框并使用jQuery UI Dialog,但我收到错误消息,指出.dialog()不是函数。

Type error

我尝试做的是在允许所有用户访问"新材料"之前提示输入用户名和密码。标签

HTML

<!--Code for the tab contents' divisions-->

<div id="dialog">
    <input type="text" id="input1" />
    <input type="text" id="input2" />
</div>
</body>

Javascript功能

function openTab(evt, divisionId) {
    if(divisionId=="addNewMaterial"){
        $("#dialog").dialog({
            close: function(event, ui) {
                // do whatever you need on close
            }
        });
    }

    else {
        // Declare all variables
        var i, tabcontent, tablinks;

        // Get all elements with class="tabcontent" and hide them
        tabcontent = document.getElementsByClassName("tabcontent");
        for (i = 0; i < tabcontent.length; i++) {
            tabcontent[i].style.display = "none";
        }

        // Get all elements with class="tablinks" and remove the class "active"
        tablinks = document.getElementsByClassName("tablinks");
        for (i = 0; i < tablinks.length; i++) {
            tablinks[i].className = tablinks[i].className.replace(" active", "");
        }

        // Show the current tab, and add an "active" class to the link that opened the tab
        document.getElementById(divisionId).style.display = "block";
        evt.currentTarget.className += " active";
    }

}

0 个答案:

没有答案