Forum Discussion
Using JavaScript with True/False Buttons
Working approach using Arrays.
https://360.articulate.com/review/content/7d62d517-ca94-4703-af3b-2e10dbcc8340/review
Using arrays its not that difficult because you can use all built-in functionality of arrays quite easily. Mainly there are a few functions in the script. First of all i got rid of the <br /> in your variables as that made it tough to convert the Storyline variables to a array.
Core part of the script is this...if(findEntryIndex(listArray,newValue)== -1){
listArray.push(newValue);
}else{
removeEntry(listArray,findEntryIndex(listArray,newValue));
}
Here i check whether the value selected already is in the array. If it is it returns a index to remove... if not it pushes the value into the array.
Hope this helps to get it working.
Kind regards,
Math