<list>
<div>abacus</div>
<div>abstract paint</div>
<div>australian coco</div>
.........
.........
.........
<div>mango</div>
<div>parrot</div>
<div>salt</div>
<div>upi</div>
</list>
The “list” tag is inside the body of a HTML document… “list” tag contains over 5000 divs… as it is a very big number, I present a part of it…
I need to insert a new div (like <div>apache</div>) among these divs alphabetically according to these divs innerHTML (innerHTML contains only alphabets and numbers, no sign)… but the problem is if I use insertBefore() method, I will get the div at the end of the list… How can I do that…??
please don’t use any jQuery… only Javascript…
Fiddle