jquery send/remove checkbox values to/from textarea field onclick

Using jquery - how can I check my various checkboxes, have the checked value go to a textarea field - this field will be hidden on the actual form.  of course, if the field is uncheck, then that value should be removed from the textarea field.

here is a cleaned up fiddle as an example:

Open in new window

if I check banana, orange and peach, -->banana, orange, peach should appear in the text field. if I uncheck orange then banana, peach should appear
Who is Participating?
leakim971Connect With a Mentor PluritechnicianCommented:
Test page : http://jsfiddle.net/75nxA/2/
    var fruits = [];
    $(".fruits:checked").each(function() {
        var name = $(this).attr("name"); // fruit1 or fruit2 or fruit3 or fruit4 or fruit5
        var value = $(this).val(); // YOU DID NOT SET THEM !!!!
        var nearText = $(this).get(0).nextSibling.nodeValue; // Banana or Cherry or Strawberry or Orange or Peach
        fruits.push( nearText );

Open in new window

quikwallaceAuthor Commented:
Wow that is nice.  Thank you!!!!
quikwallaceAuthor Commented:
Great, very, extremely complete response!!!!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.