不能移动DOM元素到其他位置
Can't move DOM element to other position
这太烦人了。我试图做一个简单的追加从一个元素到另一个:
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将追加
Squint是对的。异步get发生在appendTo之后
相关文章:
- 防止用户在jQuery Mobile中ajax加载页面时单击其他位置
- 如何'剪切'DOM元素并将其显示在其他位置
- 只在某些位置拆分数组,而不在其他位置拆分
- HTML 按钮以在页面上的其他位置提交表单
- Ajax调用正在将数据插入页面的其他位置
- 从其他位置触发文件选择窗口
- 使用 Javascript 悬停将 Div 复制到页面上的其他位置
- 如何将图像链接与 HTML 和 CSS 一起使用时,悬停时在其他位置显示图像
- 使用页面上其他位置的链接激活选项卡
- 单击按钮以显示,单击其他位置以隐藏
- 打开下拉菜单,单击页面上的其他位置
- 将WebSQL数据库复制到其他位置
- 在 SVG 动画中围绕舞台原点以外的其他位置旋转路径
- 如何发布到网址但重定向到其他位置
- 点击触摸设备上的其他位置,关闭CSS下拉菜单
- 从Javascript函数中获取值以显示在其他位置
- 当用户单击页面上的其他位置时,如何关闭自定义下拉菜单
- 在其他位置显示对象中的数据
- 在编辑表行输入值并单击jquery中的其他位置后,读取这些值
- 使用CSS悬停类悬停在链接上,并在页面的其他位置显示覆盖图像