append an element with 'id'

Posted on 2013-02-04
Last Modified: 2013-02-07
just below is original html.
<div id='top'></div>

I want to append below
<div id='parent' style='height :20%'>
    <div id='child'></div>

how can I do this in jquery?
Question by:gamjaradio
LVL 22

Assisted Solution

Mrunal earned 250 total points
ID: 38851171

Accepted Solution

Khilu earned 250 total points
ID: 38851176
Use double quote for text that you want to append.

$('#top').append("<div id='parent' style='height :20%'><div id='child'>This is child</div> </div>");

Open in new window


Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Jquery 2 13
how can i get the string decoded ? 2 14
Diminish Pop-up  in 3 seconds 7 22
VBScript on Html 8 14
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.
How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

823 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