I need a JavaScript function that allows to select only two divs out of several and insert them respectively into others. My code has 15 .item and 4 .item2. I'm developing an app that generates essay templates. The .item are keyword arguments that need to be included in a predicate structure (class .item2, which has 2 .main_place divs - it takes 2 arguments out of 15). I would like to create a function where the button to insert some .item in the .main_place is the .item itself, so that the user can define the order of presentation of arguments in the predicate based on what he selected.
<div class="item" id="arg1">first block</div>
<div class="item" id="arg2">second block</div>
<div class="item" id="arg3">third block</div>
<div class="item2">put the first block <div class="main_place">here</div> and the second one <div class="main_place">here</div>.</div>
I saw a solution here on stackoverflow (How to replace div with another div in javascript?), but it doesn't solve my problem. btw if I have to create a button, I would like the item div itself to be one
function show(param_div_id) {
document.getElementById('main_place').innerHTML =
document.getElementById(param_div_id).innerHTML;
}