Question : jQuery or JS - Checkbox set/unset in an array?

Hi,
I am new to jQuery and JS - I have a report that has a checkbox at the start of each row.
When I select the checkbox I would like to add 2 values to seperate arrays or strings;
end results I need values concatenated as follows:
1st string hidden for later processing 'ID1','ID2','ID3'....
2nd string - for display: 'John Doe (ID1)','Jane Johnson (ID2)','Maria Jones (ID3)'....

Checkbox needs to set/unset in an array or the string. ????
Thank you, Bill

Answer : jQuery or JS - Checkbox set/unset in an array?

you can maintain 2 arrays and you can capture the onclick event to see if the checkbox is selected the checkbox, based on which you can push or remove the item from array

code to check if checkbox is checked
http://www.w3schools.com/jsref/prop_checkbox_checked.asp

check this for finding adding removing items from array
http://www.swartzfager.org/thoughts/post.cfm/jquery-tip-finding-adding-and-removing-values-from-arrays

you can simply concatenate the array values by using array.join
http://www.w3schools.com/jsref/jsref_join.asp
Random Solutions  
 
programming4us programming4us