CodeIgniter Forums
hello, iam trying to onclick on one div send the content to another div - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: hello, iam trying to onclick on one div send the content to another div (/showthread.php?tid=58174)



hello, iam trying to onclick on one div send the content to another div - El Forum - 05-22-2013

[eluser]dinisptc[/eluser]
hello, iam trying to onclick on one div send the content to another div

i can send the content from one div to another

the problem now its to send only the one that its clicked on

Code:
[removed]
      document.getElementById('there').appendChild(
        document.getElementById('eee')
      );


Code:
<form acti method="post">
  <h3>Contractors</h3>
  <p>Choose some existing contractors in the left column by clicking their name or delete in the right column by the same way</p>
  
  <div id="here" class="blocBlanc l40"  scroll">
  <h4>Contractors</h4>
   <ul>
    <li id="eee" ><strong>Firm 5</strong>
     <ul class="liste">
      <li><a href="addContractorToProject?uid=&lt;?php //echo $contactUID; ?&gt;">Contractor Firstname Name</a></li>
      <li><a href="addContractorToProject?uid=&lt;?php //echo $contactUID; ?&gt;">Contractor Firstname Name</a></li>
      <li><a href="addContractorToProject?uid=&lt;?php //echo $contactUID; ?&gt;">Contractor Firstname Name</a></li>
      <li><a href="addContractorToProject?uid=&lt;?php //echo $contactUID; ?&gt;">Contractor Firstname Name</a></li>
     </ul>
    </li>
    
    <li><strong>Firm 2</strong>
     <ul class="liste">
      <li><a href="addContractorToProject?uid=&lt;?php //echo $contactUID; ?&gt;">Contractor Firstname Name</a></li>
     </ul>
    </li>
    
    <li><strong>Firm 3</strong>
     <ul class="liste">
      <li><a href="addContractorToProject?uid=&lt;?php // echo $contactUID; ?&gt;">Contractor Firstname Name</a></li>
      <li><a href="addContractorToProject?uid=&lt;?php // echo $contactUID; ?&gt;">Contractor Firstname Name</a></li>
     </ul>
    </li>
   </ul>
  </div>
  
  <div id="there" class="blocBlanc l40">
  <h4>Project contractor</h4>
   <ul>
    <li><strong>Firm 1</strong>
     <ul class="liste">
      <li><a href="deleteContractorFromProject?uid=&lt;?php //echo $contactUID; ?&gt;">Contractor Firstname Name</a></li>
     </ul>
    </li>
    
    <li><strong>Firm 2</strong>
     <ul class="liste">
      <li><a href="deleteContractorFromProject?uid=&lt;?php //echo $contactUID; ?&gt;">Contractor Firstname Name</a></li>
     </ul>
    </li>
    
   </ul>
  </div>
  
  <div class="clear"></div>
  &lt;input type="submit" class="submit" value="next step" /&gt;
  
&lt;/form&gt;



hello, iam trying to onclick on one div send the content to another div - El Forum - 05-23-2013

[eluser]TheFuzzy0ne[/eluser]
I don't understand how this is meant to work, or rather, what purpose this serves. You want the entire content of the div to move to the other, or the selected <ul> element?

I would recommend using jQuery. You can then find all the relevant <div> elements, and assign an onclick event to each of them. There are also plugins that will allow you to set up a drag and drop interface quite easily, although I strong suggest you make sure your app works without Javascript first, and then add some Javascript to make super-sexy.