javascript - 类选择器在我测试时返回 null

标签 javascript jquery css insert spiceworks

我有一个 set html 的 snipper。基本结构是

<div>
 <div></div>
 <div class="some_class another_class ticket_print_wrapper visible"></div>
</div>

所以我想通过代码插入另一个按钮。为此,我正在使用(目前粗略):

$(".ticket_print_wrapper").insertAfter("<p>Moo</p>");

这里有一个jsfiddle: http://jsfiddle.net/Zmxpt/

它似乎不接受 ".ticket_print_wrapper" 作为对象。谁能打破我在这个问题上的不眠之痛,好吗?

最佳答案

使用 $(".actions").append("<p>Moo</p>");如果您想使用两个按钮在同一级别添加其他内容。

Demo

关于javascript - 类选择器在我测试时返回 null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24943273/

相关文章:

jquery - Foundation Zurb 6 以列为中心的内容

javascript - C3js行数据,自定义颜色

使用 Phonegap 全局数组的 Javascript 不起作用

jQuery 悬停在 WordPress 中不起作用

javascript - .is() 在 Cheerio 中不存在?

jquery - 在 Fullcalendar 上拖放隐藏事件

javascript - localStorage 保存和检索元素的 CSS

javascript - React.js 中的 Spread Notation 渲染函数和变量作用域

javascript - 使用 Jquery 单击时变换比例

html - 如何删除选择输入的默认 chrome 样式?