How to pass data-name in a textarea field?

Zdravstvuite! There are the accordion and each of the containers has the same button but with different data-name. In this data-name is text. The question is, how do I transfer a data-name in the textarea of the popup window from the specific button you pressed? codepen.io/anon/pen/ryERbW

Ie when you click on the random button in the pop-up window in the field the textarea should ustulata headers of the accordion container. Mauris Sed non urna, Nam enim risus
June 27th 19 at 14:57
1 answer
June 27th 19 at 14:59
Solution
$( function() {
$('#accordion').accordion({
 heightStyle: "content"
});
 $('button[data-toggle="modal"]').on('click', function(e){
 const text = $(this).data('name');
$('.modal-body').find('textarea').val(text);
})
});

Find more questions by tags HTMLJavaScriptjQuery