manishjangir manishjangir - 1 year ago 87
HTML Question

create child div in a parent div using jquery

I have the following div structure

<div id="main_div">
<div id="lastChildDiv"></div>

now I want to create or append a new
above the div id of
. Then how to do it?

Answer Source

Use prepend

$('#main_div').prepend('<div id="new_div">...</div>');
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download