JSFiddle - React, Tailwind, and code Playground
by ajmeese7
HTML
<input id="text_tag_input1" type="text" name="tags" />
<input id="text_tag_input2" type="text" name="tags" />
<input id="text_tag_input3" type="text" name="tags" />
<div class="tags_select">
<input type='checkbox' name='check' value='value' id='input1' >
<input type='checkbox' name='check' value='value' id='input2' >
<input type='checkbox' name='check' value='value' id='input3' >
<a id="tags_select1" href="#">text1</a>
<a id="tags_select2" href="#">text2</a>
<a id="tags_select3" href="#">text3</a>
</div>
JavaScript
$('.tags_select').click(function() {
var value1 = document.getElementById("tags_select1").innerText;
var value2 = document.getElementById("tags_select2").innerText;
var value3 = document.getElementById("tags_select3").innerText;
var input1 = $('#text_tag_input1');
var input2 = $('#text_tag_input2');
var input3 = $('#text_tag_input3');
input1.val(input1.val() + value1 + ', ');
input2.val(input2.val() + value2 + ', ');
input3.val(input3.val() + value3 + ', ');
return false;
});