javascript - Move div element from one parent div to another -


so let's assume have set of nested divs:

<div id="likelytobecalled">     <div id="likelyoddheader" class="row">         <div id="likelyodda" class="left" name="test1">test1</div>         <div id="likelyoddb" class="middle"><img src="image002.png"/></div>         <div id="timezone" class="right">west</div>     </div> 

and further down page:

<div id="unlikelytobecalled">     <div id="likelyoddheader" class="row">         <div id="likelyodda" class="left">test2</div>         <div id="likelyoddb" class="middle"><img src="image002.png"/></div>         <div id="timezone" class="right">west</div>     </div> 

how move test1 "unlikelytobecalled". i've been trying form / submit button kicks, here's code that:

<script type="text/javascript">     function dosubmit() {         document.getelementbyid('unlikelytobecalled').appendchild(             document.getelementsbytagname('test1')         );     } </script> <br /><br /><br /> <form method="post" action="file:///c:/wamp/www/index.html" id="submitform" name="submitform">     <input type="submit" name="submit" value="move divs" onclick="dosubmit()"  /> </form> 

or effect. rock

use .appendto()

$('#likelyodda').appendto('#unlikelytobecalled') 

Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -