The code below throws an exception in firefox:
$(function(){
$(["one","two","three"]).each(function(){
if(this == "one")
$("div#msg").html(this);
});
});
the exception is this:
Could not convert JavaScript argument arg 0 [nsIDOMDocumentFragment.appendChild]
Yet if I change code and use this.toString() as follows, it works:
$(function(){
$(["one","two","three"]).each(function(){
if(this == "one")
$("div#msg").html(this.toString());
});
});
If "this" is a string, why do I need to do toString()? Is there a nuance of javaScript which I am missing or am I just being a moron? Please tell me it's a nuance.