JQuery UI 1.8.10 Cannot read property '3' of undefined

I use JQuery UI 1.8.10 and jquery latest.

My code is:

<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/jquery-ui.js"></script>
<script type="text/javascript" src="/cms/ww.admin/login/login.js"></script>
</head>
<body>

<div id="header"></div>
<?php
    if(isset($_REQUEST['login_msg']))
    {
        require SCRIPTBASE.'cms/ww.incs/login-codes.php';
        $login_msg = $_REQUEST['login_msg'];
        if(isset($login_msg_codes[$login_msg]))
        {
            echo '<script>$(function(){$("<strong>'.htmlspecialchars($login_msg_codes[$login_msg]).'</strong>").dialog({modal:true});});</script>';
        }

?>

why does this give a cannot read property '3' of undefined error?

the file that gives the error is jquery-ui.js on line 186

okay now i changed it to:

</head>
<body>

<div id="header"></div>
<div id="login-msg"></div>
<?php
if(isset($_REQUEST['login_msg'])){
require SCRIPTBASE.'cms/ww.incs/login-codes.php';
$login_msg=$_REQUEST['login_msg'];
if(isset($login_msg_codes[$login_msg])){
   echo '<script>$(function(){
                    $("#login-msg").html("<strong>'.htmlspecialchars($login_msg_codes[$login_msg]).'</strong>").dialog({modal:true});});</script>';
}
}
 ?>

But still the same error

Answers


It's a bug from your jQueryUI which use a :data selector (if you go up in the call stack you will see it) which is deprecated/not compatible with latest jQuery. Try with this jQueryUI :

http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.22/jquery-ui.min.js

example here :

http://jsfiddle.net/techunter/RyUVq/


You found a bug/incompatibility!!

this isn't working jquery (1.8.0): http://jsfiddle.net/mZPWS/

Older jquery version (1.7.2) is working: http://jsfiddle.net/mZPWS/1/


It might not be the source of your problem, but maybe setting a div for your .dialog() widget can help you.

Your js line $("<strong>'.htmlspecialchars($login_msg_codes[$login_msg]).'</strong>").dialog({modal:true} seems to be using a simple message, which in most cases works.

Can you try changing using this line instead :

$(function()
{
    $("#header") // or any div you have
    .html("<strong>'.htmlspecialchars($login_msg_codes[$login_msg]).'</strong>")
    .dialog({modal:true});
});

also, make sure your "/cms/ww.admin/login/login.js" is not the source of the error, the js error console gets easily lost and can point you to jquery-ui.js while the error is somewhere else.


I confirm the uncompatibility issue. Tried with jquery-1.8.0 and jquery-ui-1.8.4


Need Your Help

JSON Jackson - exception when serializing a polymorphic class with custom serializer

java json jackson

I'm currently migrating some code from Jackson 1.x to Jackson 2.5 json mapper and came a long a problem that wasn't there in 1.x.

AngularJS doesn't update img src when model changes

javascript html angularjs

I use ng-src to load images. Value is loaded from some scope variable, like this: