0

这越来越令人厌烦了。我正在尝试从一个元素到另一个元素的简单附加:

            var contentBlob = $('<div></div>', {
                "id"    : "content-blob",
                "css"   : {
                    "display" : "none",
                    "color" : "red"
                    }
            });

            // this guy gets a full xhtml page with head and body.  
            // I don't want to use load()
            model.getHtml(indexUrl, function(response){
                    if(response != 0){
                        contentBlob.html(response);
                    }
            });

            contentBlob.appendTo('body');
            //I've verified the that the contentBlob (#content-blob) is in the body

            // This should be super simple.  No matter what I do, Its not appending 
            // the ul.
            $('#content-blob > ul').appendTo('#contents-index-actual-index');

我已经三次检查了选择器,一切看起来都是合法的。一件有趣的事情是,如果我不将 ul 添加到选择器,#content-blob 将附加。

4

1 回答 1

0

斜视是对的。异步获取发生在 appendTo 之后。

于 2013-05-03T17:21:28.153 回答