jquery store input value into empty array element
问题 I have this array var foods = new Array(); foods = [ { id: 1, correct:'icecream', display: 'icecream', response: ''}, { id: 2, correct:'sundae', display: 'sundae', response: ''}, ]; and this html div <div id="showfoods" class="foodlist"> <div <input id="inputFoodChoice"class="foodinput" /></div> </div> Here's a jquery portion of what will happen with the form portion of the project function FoodDisplay() { var txtTrial = ""; $("#showfoods").hide(); txtTrial = trials[curTrial].display; $("