How to Sort Div Content In Descending Order By Image Name?

Posted by MrSeth on Stack Overflow See other posts from Stack Overflow or by MrSeth
Published on 2012-10-31T22:59:29Z Indexed on 2012/10/31 22:59 UTC
Read the original article Hit count: 97

Filed under:
|

I would like to sort a div by DESCENDING order based on their image name.

Change From this:

<div id="sort-this-div">
<p><img src="image/1.jpg"/></p>
<p><img src="image/3.jpg"/></p>
<p><img src="image/4.jpg"/></p>
<p><img src="image/2.jpg"/></p>
</div>

To This

<div id="sort-this-div">
<p><img src="image/4.jpg"/></p>
<p><img src="image/3.jpg"/></p>
<p><img src="image/2.jpg"/></p>
<p><img src="image/1.jpg"/></p>
</div>

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about div