JSFiddle - React, Tailwind, and code Playground
HTML
<a href='[email protected]' class='mailto'>User 1</a>
<a href='[email protected]' class='mailto'>User 2</a>
<br>
Email To: <span id='list'></span>
<a href='mailto:' id='combined' style='display: none;'></a>
<br>
<input type='button' value='Send' id='send'>
<input type='button' value='Clear' id='clear'>
JavaScript
$(document).ready(function() {
$('.mailto').click(function(e){
e.preventDefault();
$('#combined').attr('href',$('#combined').attr('href') + $(this).attr('href') + ';');
$('#list').html($('#list').html() + $(this).html() + ', ');
});
$('#send').click(function(e) {
$('#combined')[0].click();
});
$('#clear').click(function(e) {
$('#combined').attr('href','mailto:');
$('#list').html('');
});
});