Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Here is what I put together. You can check out the working demo on jsfiddle: <a href="http://jsfiddle.net/nathanmyles/CXWYa/" rel="nofollow">http://jsfiddle.net/nathanmyles/CXWYa/</a></p> <p>JavaScript</p> <pre><code>function setup(){ var done = document.getElementById('done'); attachClickEvents(done, moveToUndone); var undone = document.getElementById('undone'); attachClickEvents(undone, moveToDone); } function attachClickEvents(parent, moveFunction){ var elements = parent.children; for(var i = 0; i &lt; elements.length; i++){ var element = elements[i]; if(element.tagName.toLowerCase() === 'input'){ var id = element.id; attachOnClick(element, moveFunction, id); } } } function moveToDone(id) { remove(id); append('done', createCheckBoxElement(id, moveToUndone)); } function moveToUndone(id) { remove(id); append('undone', createCheckBoxElement(id, moveToDone)); } function createCheckBoxElement(id, moveFunction){ var element = document.createElement('input'); element.setAttribute('type', 'checkbox'); element.setAttribute('name', id); element.setAttribute('id', id); attachOnClick(element, moveFunction, id); return element; } function attachOnClick(element, callback, id){ element.onclick = function() { callback(id); }; } function append(parentId, element){ var parent = document.getElementById(parentId); parent.appendChild(element); } function remove(id) { var element = document.getElementById(id); element.parentNode.removeChild(element); } setup(); </code></pre> <p>HTML</p> <pre><code>&lt;table width="427" height="88"&gt; &lt;tr&gt; &lt;td id="undone"&gt;Undone &lt;br /&gt; &lt;input type="checkbox" name="chk1" id="chk1" /&gt; &lt;input type="checkbox" name="chk2" id="chk2" /&gt; &lt;input type="checkbox" name="chk3" id="chk3" /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td id="done"&gt;Done &lt;br /&gt; &lt;input type="checkbox" name="chk4" id="chk4" /&gt; &lt;input type="checkbox" name="chk5" id="chk5" /&gt; &lt;input type="checkbox" name="chk6" id="chk6" /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload