JSFiddle - React, Tailwind, and code Playground
HTML
<form>Select your place:
<fieldset id="mySelect">
<input type="checkbox" value="[email protected]">l1
<br>
<input type="checkbox" value="[email protected]">l2
<br>
<input type="checkbox" value="[email protected]">l3
<br>
<input type="checkbox" value="[email protected]">l4
<br>
</fieldset>
</form>
<button type="button" onclick="displayResult()">Confirm Location</button>
<a id="send" href="mailto:">Send email</a>
<div id="myEmailList">
JavaScript
function displayResult() {
var se = document.getElementById("myEmailList"),
send = document.getElementById("send"),
x = document.getElementById("mySelect"),
l = [],
list = x.querySelectorAll(":checked");
for (i = 0; i < list.length; i++) {
l.push(list[i].value);
}
send.href = "mailto:" + l.join(", ");
se.innerHTML = l.join(", ");
}