I have Div
that it contains some other elements like <p>
, <ul>
,... How I can Add a Div
as first child od my main div?
consider this tags:
<div id="MainDiv">
<p>....
<ul>...
<span>....
</div>
I want it become:
<div id="MainDiv">
<div id="newDiv"></div>
<p>....
<ul>...
<span>....
</div>
$('#MainDiv').prepend('<div id="newDiv"></div>');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.