JSFiddle - React, Tailwind, and code Playground
by Prasad Gavande
HTML
<!-------------------------------------------------
move element with changin div id
-------------------------------------------------->
<div id="panel1">
<input type="button" value="add" id="btn1" />
<br>
<input type="button" value="add" id="btn2" />
<br>
<input type="button" value="add" id="btn3" />
</div>
<div id="panel2" style="background-color:gray"></div>
JavaScript
var flag = 0 ;
$(document).ready(function(){
$("input[value='add']").click(function () {
$(this).appendTo("#panel2");
$(this).val("remove");
$(this).click(function () {
$(this).appendTo("#panel1");
$(this).val("add");
$(this).click(function(){
$(this).appendTo("#panel2");
$(this).val("remove");
});
});
});
});