ingridsede
ingridsede

Reputation: 339

append existing element to div as a first/last child

Please ignore this question from now. I made a huge mistake. :-)

I have this problem with appending a div (a user div with html in it)from one div to another div. I want to be able to move the "user_u_1"-divs between the containing "regionheader"-divs. Their classes should change also. I have a Fidle prepared. Right now if a want to append a div from the above div to the second div it appends it to the last one.

the structure is as follows:

<div id="onlineList">

    <div class="regionheader" id="one">
        <span class="regionspan"><h3>One</h3></span>
        <div id="user_u_1" class="One" name="Joe">1</div>
        <div id="user_u_2" class="One" name="Joe">2</div>
        <div id="user_u_3" class="One" name="Joe">3</div>
    </div>

    <div class="regionheader" id="two">
        <span class="regionspan"><h3>Two</h3></span>
        <div id="user_u_4" class="Two" name="Joe">4</div>
        <div id="user_u_5" class="Two" name="Joe">5</div>
        <div id="user_u_6" class="Two" name="Joe">6</div>
    </div>

    <div class="regionheader" id="three">
        <span class="regionspan"><h3>three</h3></span>
        <div id="user_u_7" class="three" name="Joe">7</div>
        <div id="user_u_8" class="three" name="Joe">8</div>
        <div id="user_u_8" class="three" name="Joe">9</div>

    </div>
</div>  

Upvotes: 0

Views: 123

Answers (1)

Jason Cust
Jason Cust

Reputation: 10899

You have a typo in your HTML.

The offending line:

<div id="user_u_4" class="Two" name="Joe" >4<html/div>

Should be:

<div id="user_u_4" class="Two" name="Joe" >4</div>

Updated fiddle that works.

Upvotes: 2

Related Questions