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

$(document).ready(function(){
	$("input[value='add']").click(function () {
		$(this).appendTo("#panel2");
		$(this).val("remove");   
	  // remove();	  
		$("input[value='remove']").click(function () {
			$(this).appendTo("#panel1");
			$(this).val("add"); 
		});		
	});

});