I am trying to define some basic HTML:

我试图定义一些基本的HTML:

<ul id="menu" style="display:none">
    <li><a class="actions" href="1">1</a></li>
    <li><a class="actions" href="2">2</a></li>
    <li><a class="actions" href="3">3</a></li>
</ul>

And append it dynamically using jquery like so:

并使用jquery动态附加它,如下所示:

$('#container').append($('#menu')).show()

However all that's returned is the physical Object:

然而,所有返回的是物理对象:

<div id="container">[object Object]</div>

Can my menu div be appended in this fashion?

我的菜单div可以这种方式添加吗?

UPDATE: Revised where the show() is placed, but outcome remains the same

更新:修改show()的位置,但结果保持不变

3 个解决方案

#1


1

While this might work, I would probably run .show() AFTER you append the items to the page. The .append does not expect a function, it's just expecting a DOM element, which may be the cause of your problems.

虽然这可能有效,但我可能会在将项目追加到页面后运行.show()。 .append不期望一个函数,它只是期待一个DOM元素,这可能是你的问题的原因。

更多相关文章

  1. 是否有办法阻止contenteditable的插入符号出现在IE10的元素上?
  2. CSS3(jQUery?)当它悬停时隐藏元素“a”,这样就可以显示元素“b”
  3. 无法使用jquery将活动类添加到当前选定的菜单
  4. JQuery的。简单的下拉选择菜单行为问题
  5. 停止鼠标用javascript双击某些元素
  6. 在量角器中检索子元素的数组
  7. 4th,Python三级菜单
  8. 从Python中的列表元素中删除URL
  9. python selenium-webdriver 定位frame中的元素 (十三)

随机推荐

  1. 在IE6中JS不执行的问题处理
  2. PHP XAMPP配置PHP环境和Apache80端口被占
  3. 【PHP面向对象(OOP)编程入门教程】15.sta
  4. 看见有人发帖“php能做什么”,我不得不也
  5. Laravel Auth只验证管理员/超级用户
  6. 如何用PHP和MYSQL在逗号分隔的列表中找到
  7. phpStudy 2016 更新下载,新版支持php7.0
  8. 2016.5.27 php测试中敏感度高,怎么调整
  9. jsonencode添加一个空行,为什么?
  10. 如何将java中的值添加到php中?