So I have this code:
$('.submit_button').click(function() {
var optionsArray = $(".inputID").map(function() {
return this.value;
}).get().join(",");
var randomOutput = optionsArray[Math.floor(Math.random()*optionsArray.length)];
console.log(randomOutput);
});
What I'm trying to do upon clicking the button (.submit_button) is for it to take the user entered data (they are inputs with the class .inputID), store them in an array (which i have done and it works) and then console.log (at least for now while I'm testing) one of the inputs at random. What it currently does is just console.logs a single character instead of a whole item from the array. What am I doing wrong?
.join(), which gives a string instead of an array.