Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
HTML
<html>
<head>
 
<style type="text/css">
 
div.ex1
{
    width:100px;
    padding:20px;
    border:1px solid gray;
    margin:0px;
}
div.ex2
{
    width:100px;
    padding:20px;
    border:1px solid gray;
    margin:0px;
}
</style>
 
<script type="text/javascript">
 
function mirror()
{
    var data=document.getElementById("theDiv");
    document.getElementById("theDiv").innerHTML=" "+data.innerHTML+'<input type="checkbox"></input>'+ document.getElementById("txtarea").value+"<br>";
    
}
 

</script>
</head>
<body>
 
<br>
<table><tbody><tr>
 
<input name="txtarea" id="txtarea" type="text">
 
<input type="button" name="Submit" value="Submit" onclick ="mirror()">
</tr></tbody></table>
<br>
<table><tbody><tr>
 
<!--<textarea class="bgclr" wrap="virtual" rows="4" cols="30" disabled>
</textarea>
<textarea class="bgclr" name="textarea"wrap="virtual" rows="4" cols="30" disabled>
 
</textarea>-->
 

<div id="theDiv" class="ex1">
</div>
 
<input type="button" name="submit" value="shift" ><br>
<br>
<div class="ex2">
</div>
 
<input type="button" name="submit" value="remove" ><br>
 
</body>
</html></br></br></br></tr></tbody></table></br></br></br>
Posted
Updated 20-Mar-12 1:19am
v6
Comments
Pravin Patil, Mumbai 20-Mar-12 5:09am    
EDIT : Added html code tag.

1 solution

XML
<html>
<head>
 <title></title>
<style type="text/css">

div.ex1
{
    width:100px;
    padding:20px;
    border:1px solid gray;
    margin:0px;
}
div.ex2
{
    width:100px;
    padding:20px;
    border:1px solid gray;
    margin:0px;
}
</style>

<script type="text/javascript">

    var id = 1;
    function mirror() {
        var checkboxID = 'checkID' + id;
         var spanID = 'Span' + id;
        alert(checkboxID);
        var data = document.getElementById("theDiv");
        document.getElementById("theDiv").innerHTML = " " + data.innerHTML + ' <span id=' + spanID + ' onchange=check("' + spanID + '")> <input id="' + checkboxID + '" type="checkbox" /> ' + document.getElementById("txtarea").value + "<br> </span>";
        id++;
    }
    function check(targ) {
        alert(targ);
        var element = document.getElementById(targ);
        alert(element.innerHTML);
        document.getElementById("div1").innerHTML += '<span id=' + targ + ' >' + element.innerHTML + '</span>';
        element.parentNode.removeChild(element);



    }

</script>
</head>
<body>

<br />
<table><tbody><tr>
 <td>
<input name="txtarea" id="txtarea" type="text" />
 </td>
 <td>
<input type="button" name="Submit" value="Submit" onclick ="mirror()" />
</td></tr></tbody></table>
<br />
<table><tbody><tr>
 <td>
<!--<textarea class="bgclr" wrap="virtual" rows="4" cols="30" disabled>
</textarea>
<textarea class="bgclr" name="textarea"wrap="virtual" rows="4" cols="30" disabled>

</textarea>-->


<div id="theDiv" class="ex1">
</div>

<input type="button" name="submit" value="shift" /><br/>
<br/>
<div id="div1" class="ex2">
</div>

<input type="button" name="submit" value="remove" /><br/>
 <br/><br/><br/></td>
    <td>
        </td>
    </tr></tbody></table>
    <input id="checkboxID" type="checkbox" onchange="check('checkboxID')" />
</body>
</html>
 
Share this answer
 
v2
Comments
2011999 21-Mar-12 0:32am    
thank u for send solution. when i am click the shift button after that move the check id items. and click the remove button remove the check id's.
2011999 21-Mar-12 2:50am    
i need above shift and remove functionality in jquery

1.If submit button is clicked add item to first div with checkboxes.

2If move button is clicked go through all checkboxes in the first div if any checkbox is in checked condition move that item to second div.

3.If remove button is clicked go through all checkboxes in the second div if any checkbox is in checked condition remove that that item in the second div

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900