manishjangir manishjangir - 1 year ago 49
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>');