[jQuery] Problem with DOM manipulation in IE
I'm trying to populate set of lists via some information loaded from
some JSON on $(document).ready. The following code works fine in FF
but breaks in IE:
function insertItem(item)
{
var li = $("<li>").html("Item: ");
$(<span>).html(item.text).appendTo(li);
return li;
}
.
.
.
function buildList()
{
// psuedo code here
for ( each item in list )
{
$("#mylist").insertItem(item);
}
}
In FF/Safari the above code works perfectly fine. In IE the above
code returns an item with only the <li> element but not the inserted
span element. Why?
Can someone help me with this problem?