enter image description here

From the picture above, I want to clone the div with id #car2 and append it after the last div with id start with car, in this example id #car5. How can I do that? Thanks.

这是我的try 代码:

$("div[id^='car']:last").after('put the clone div here');

推荐答案

You can use clone, and then since each div has a class of car_well you can use insertAfter to insert after the last div.

$("#car2").clone().insertAfter("div.car_well:last");

Jquery相关问答推荐

如何用each替换元素的attr href

子 li 元素的点击事件

JQuery - 从先前 Select 的下拉列表中隐藏/显示选项

jQuery:在mousemove事件期间检测按下的鼠标按钮

如何用另一个响应替换窗口的 URL 哈希?

在 for 循环中分配点击处理程序

什么是不使用 jQuery 的经验技术原因?

jQuery: Select 属性大于值的所有元素

jQuery $.browser 是否已弃用?

jquery - 单击事件不适用于动态创建的按钮

window.onbeforeunload 和 window.onunload 在 Firefox、Safari、Opera 中不起作用?

具有动态大小图像的马赛克网格 gallery

jQuery Force 为 iframe 设置 src 属性

jQuery Button.click() 事件被触发两次

Twitter Bootstrap css 类的 jQuery show() 隐藏

.apply jQuery 函数是什么?

使用 JavaScript 获取用户代理

使用 JQuery 激活 bootstrap 选项卡

如何在按键事件后获取 jQuery .val()?

Chrome 中的 AJAX 发送选项而不是 GET/POST/PUT/DELETE?