[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

jquery insert item into bottom of a div

Posted on 2009-05-15
1
Medium Priority
?
3,099 Views
Last Modified: 2012-06-21
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
Comment
Question by:jackjohnson44
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 12

Accepted Solution

by:
alien109 earned 2000 total points
ID: 24398971
var newlyInsertedDiv = $("#template").clone();
$("#menu").append(newlyInsertedDiv);
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer…
In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question