JSFiddle - React, Tailwind, and code Playground
by JamesD
HTML
<ul>
<h2>small alpha</h2>
<li>a</li>
<li>b</li>
<li>C</li>
<a href="#">get</a>
</ul>
<ul>
<h2>big alpha</h2>
<li>A</li>
<li>B</li>
<li>C</li>
<a href="#">get</a>
</ul>
<ul>
<h2>number</h2>
<li>1</li>
<li>2</li>
<li>3</li>
<a href="#">get</a>
</ul>
JavaScript
var Arr= [];
$('a').click(function(){
var key = $(this).closest('ul').find('h2').text();
Arr[key] = [];
Arr[key].push($(this).closest('ul').find('li')
.map(function() { return $(this).text() }).get());
console.log(Arr)
})