jQuery 1.6.2错误与操作不支持“代码:”9

时间:2011-07-14 10:25:36

标签: jquery jquery-ui

我在firebug中收到以下错误:不支持jQuery 1.6.2错误操作“代码:”9。首先有人能告诉我这个错误的确切含义吗?其次,我正在做的是使用对话框显示一个显示正常的表单,但每当我点击输入字段时,它都会触发此错误。我已经附上了我的代码,并希望得到一些指导:

jQuery 1.6.2 jQuery-ui 1.8.14

// Help function

function help() {

    $(function () {

        $('#feedback').dialog({
            resizeable: true,
            title: "Mail Help",
            width: 500,
            height: 420,
            modal: true,
            overlay: {
                backgroundColor: "#000",
                opacity: 0.3
            }


        });
        $("feedback").dialog('open');
    });
}


// Feedback form
<div id="form" style="display:none;">
  <form method="post" id="feedback" class="webform" name="feedback">


        <label for="company">Company</label>
        <select name="company" id="company">
                <option SELECTED VALUE="">Select an option</option>
                <option value="Technical">Technical</option>
                <option value="Database">Database</option>
                <option value="Error">Error</option>
                <option value="Other">Other</option>
        </select>
        <label for="name">Full Name:</label>
                <input id="uname" name="uname"  type="text" class="text ui-widget-content ui-corner-all inputbox uname" value="<?php echo $_SESSION['kt_name_usr']; ?>" />
        <label for="email">Email address:</label>
                <input id="email" name="email" type="text" class="text ui-widget-content ui-corner-all inputbox email" value="<?php echo $_SESSION['kt_email_usr']; ?>" />
        <label for="position">Position:</label>
                <input id="position" name="position" type="text" class="text ui-widget-content ui-corner-all inputbox position" />
        <label for="feedbacknew">Feedback:</label>
                <textarea id="feedbacknew" name="feedbacknew" cols="25" rows="3" type="text" class="text ui-widget-content ui-corner-all inputbox feedbacknew">Please make sure that any error messages or numbers are listed here </textarea><br />

        <button id="submit" class="submit">Submit</button>
        <div id="message"></div>
  </form>
</div>

1 个答案:

答案 0 :(得分:2)

在我的一些案例中找到了解决方法。

在jQuery源代码(不是min)中找到这个块:

if ( document.documentElement.contains ) {
    Sizzle.contains = function( a, b ) {
        return a !== b && (a.contains ? a.contains(b) : true);
    };

} else if ( document.documentElement.compareDocumentPosition ) {
    Sizzle.contains = function( a, b ) {
        return !!(a.compareDocumentPosition(b) & 16);
    };

} else {
    Sizzle.contains = function() {
        return false;
    };
}

并为行return !!(a.compareDocumentPosition(b) & 16);

添加try-catch
if ( document.documentElement.contains ) {
    Sizzle.contains = function( a, b ) {
        return a !== b && (a.contains ? a.contains(b) : true);
    };

} else if ( document.documentElement.compareDocumentPosition ) {
    Sizzle.contains = function( a, b ) {
        try {
            return !!(a.compareDocumentPosition(b) & 16);
        }
        catch (e) {
            return false
        }
    };

} else {
    Sizzle.contains = function() {
        return false;
    };
}

为什么会发生这种情况,您可以在“例外”部分阅读here