I have many div elements with same class names. I want the user to be able to choose some of them in to a form input text element (value). So far I only made it put the last clicked one.
<div class="post">
<div class="addThis">A</div>
<div class="addThis">B</div>
<div class="addThis">C</div>
</div>
<input type="text" id="Choice">
jQuery('.addThis').click(function() {
var x = jQuery(this).closest('.post').find('addThis').text();
var y = jQuery("#Choice").val(x);
The var y is there because I tried to do something with it. But all attempts failed. Tried with
var t += y;
jQuery("#Choice").val(t);
and a lot that I already forgot
Thanks for your help
<input type="checkbox" id="chkA" class="addThis" value="A" /><label for="chkA">A</label>