I have the following code:
<code><pre>var depth = 2;
var name = 'category' + depth;
var html = $('<div class="indent">'
+ "\n<p>\n" +
'<label for="' + name + '">Sub
Category:</label> ' +
'<select id="' + name + '"
name="' + name + '">' + "\n" +
'<option value="none">Select a
sub category</option>' + "\n" +
'<option value="0">Add new sub
category</option>' + "\n" +
"</select>\n</p>\n</div>
\n");
alert($(html).children('p')[0].nodeName);</pre></
code>
In FF, IE7 and Safari it will alert 'p', but in Opera (tested 9.64 and
10Alpha1) I just get an error in the Error Console:
<code><pre>JavaScript -
http://photosite.com/uploadTimeout thread: delay 13 ms
Error:
name: TypeError
message: Statement on line 21: Cannot convert undefined or null to
Object
Backtrace:
Line 21 of linked script
http://photosite.com/CSI/js.js alert($(html).children('p')[0].nodeName);
Line 19 of linked script
http://photosite.com/CSI/jquery-1.3.2.min.js:In function I
function I(){if(M.success){M.success(V,R)}if(M.global)
{o.event.trigger("ajaxSuccess",[J,M])}}
Line 19 of linked script
http://photosite.com/CSI/jquery-1.3.2.min.js function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if
(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&
(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}
R=X=="timeout"?"timeout":!o.httpSuccess
(J)?"error":M.ifModified&&o.httpNotModified
(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData
(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try
{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y)
{o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if
(X){J.abort()}if(M.async){J=null}}}}
...
stacktrace: n/a; see 'opera:config#UserPrefs|Exceptions Have
Stacktrace'</pre></code>
If I run the code in the Command Line in Opera Dragonfly it just gives
the error:
<code>Cannot convert undefined or null to Object</code>
Can anyone help me with this? (I couldn't find any info on if this
message will be encoded as html or plain text, but in the event it
comes out as plain text, you can see the code snippets here:
http://www.thewebsqueeze.com/forum/Javascript-f66/Jquery-Function-Not-Working-In-Opera-t4371.html)Thanks
Dave