• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3101
  • Last Modified:

jquery insert item into bottom of a div

I have a document like this

<div id="menu"></div>

<div class="itemplate"></div>  //This is what I am cloning and moving

I want to put items into the menu, so
<div id="menu">
   <div id="item_1"></div>
   <div id="item_2"></div>
</div>


I want to insert an item into the last position inside the menu.  The menu could start off blank.

I can successfully keep inserting items after somethign, but that is not what I want to do.
var newlyInsertedDiv = $("#template").clone().insertAfter($(".menu"));
newlyInsertedDiv.attr("id", "item_" + counter);


How do I make it so I can insert my cloned div into the last position inside menu?
0
jackjohnson44
Asked:
jackjohnson44
1 Solution
 
alien109Commented:
var newlyInsertedDiv = $("#template").clone();
$("#menu").append(newlyInsertedDiv);
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now