Reputation: 752
In JavaScript I need help appending values into a textbox. What happens is that with the relevant piece of code below, the user can add an "Option Type" from a table row into the textbox. For example if the user clicks on the "Add" button and within that row the Option Type is "True or False", then I want it to display number 27 in the textbox, and if "Option Type" is "Yes or No" then display number 28 in the textbox. So I want it like below
Option Type Number
True or False 27
Yes or No 28
My question is how can insert the numbers for the 2 option types into the textbox?
I tried this below for True or False but it did not work:
var myNumbers = {};
myNumbers["True-False"] = "27";
gridValues = myNumbers[gridValues];
Below is the true and false buttons:
<input name="answerTrueName" id="answerTrue" type="button" value="True" onclick="btnclick(this);"/>
<input name="answerFalseName" id="answerFalse" type="button" value="False" onclick="btnclick(this);"/>
Upvotes: 1
Views: 176
Reputation: 752
Figured it out, it is suppose to be:
var myNumbers = {};
myNumbers["True or False"] = "27";
gridValues = myNumbers[gridValues];
Upvotes: 1