Hi Jon,
Try inserting a complete DOM element rather than a partial. $("<li></li>") instead of $("<li>") Also, you're missing quotes around the <span> . Should be: $("<span></span>") instead of $(<span>) Also, this is probably breaking, too: .html(item.text) Not sure what item.text is. did you mean .html(item.text()) ? Hope that helps get you started. --Karl _________________ Karl Swedberg www.englishrules.com www.learningjquery.com On Apr 9, 2008, at 8:12 PM, Jon Loyens wrote:
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?