I'm missing something super obvious here so please excuse my ignorance :(
I have a set of 5 checkboxes and would like to print out steps based on what checkbox was chosen. I'll need this for a bigger output so I'm storing the selection in it's own variable like so:
$checkBox.find('input:checked').each(function() {
$rec = $(this).val() + "\n";
console.log($rec);
});
Everything returns fine when I select all 5 checkboxes and check in console:
However, I want to use the output stored in $rec to use later so I did this to see what it will look like:
$checkBox.find('input:checked').each(function() {
$rec = $(this).val() + "\n";
console.log($rec);
});
// call rec into text input
$textOutput.val($textOutput.val() + $rec + "\n");
console.log($rec);
But for some reason, only the "Do Step 5" is returned when calling $rec again
Since I'm already storing output of the 5 checkboxes in $rec why can't I access all again rather than just the last object?