Moving Multiple Divs With Same Class Inside Parent

Posted by superzilla on Stack Overflow See other posts from Stack Overflow or by superzilla
Published on 2013-11-03T21:51:14Z Indexed on 2013/11/03 21:53 UTC
Read the original article Hit count: 241

Filed under:
|
|
|

So, My website is hosted on enjin.com and when you give users a tag with an image it appears on the forums under their name, however it's a vertical list with the tag names. I want to organize it so all of the tag images appear on one line and all of the tag names appear on a horizontal list below it.

They use div tags somewhat like this

<div class="tag">
    <div class="tag-image"></div> <!-- If the tag lacks an image this is excluded -->
    <div class="tag-text">Tag Name</div> <!-- If you want the name to be hidden this is excluded -->
</div>

They then pretty much repeat this for every tag. Somewhat the same thing is used for forum posts too.

So, I want to move all the tag-image divs together on a single line and all of the tag-text divs down and give each it's own line. I only want to move them within their parent element (to avoid images/tags from one forum user from going to another).

I know how to append things with jquery and have googled how to move elements around, but I'm afraid that they're all going to end up together under another user's avatar.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery