Artur_Hopf,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
.cont_2{
display: none;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>
$(function() {
var arr = [], text = "", info = [], add;
$(".cont button").click(function(){
var data1 = $(this).prev().text();
var data2 = $(this).next().text();
var data = $(this).data('num');
info = [data, data1, data2];
$('.cont_2').show();
infoShow()
});
$(".cont_2 textarea").on("input", function() {
text = this.value;
infoShow()
})
function infoShow()
{
add = textCreate();
var html = arr.map(JSON.stringify).join('<br>') + '<br>' +JSON.stringify(add) ;
$('.cont_2 #show').html(html)
}
function textCreate()
{
var obj = {}, num = info[0], txt = 'Название: '+ info[1] +'<br>'+ 'номер:' + info[2] + '<br>' + text;
obj[num] = txt;
return obj
}
$("#ok").click(function(){
if(add) {
arr.push(add);
add = null;
text = "";
$(".cont_2 textarea").val("")
} ;
$('.cont_2').hide();
});
});
$(function() {
var arr = [],
text = "",
info = [],
add;
$(".cont button").click(function() {
var data1 = $(this).prev().text();
var data2 = $(this).next().text();
var data = $(this).data("num");
info = [data, data1, data2];
$(".cont_2").show();
infoShow()
});
$(".cont_2 textarea").on("input", function() {
text = this.value;
infoShow()
});
function infoShow() {
add = textCreate();
var html = arr.map(JSON.stringify).join("<br>") + "<br>" + JSON.stringify(add);
$(".cont_2 #show").html(html)
}
function textCreate() {
var obj = {},
num = info[0],
txt = "Название: " +
info[1] + "<br>" + "номер:" + info[2] + "<br>" + text;
obj[num] = txt;
return obj
}
$("#ok").click(function() {
if (add) {
arr.push(add);
add = null;
text = "";
$(".cont_2 textarea").val("")
}
$(".cont_2").hide()
})
});
</script>
</head>
<body>
<div class="cont">
<div>Текст</div><button data-num="445563">Кнопка</button><div>123</div>
<div class="cont">
<div>go</div><button data-num="123">Кнопка</button><div>0000</div>
</div></div>
<div class="cont_2" hidden="true">
<div id="show"></div>
<textarea name="txtComment"></textarea>
<button id="ok">Ок</button>
</div>
</body>
</html>