I have the following code:
<select>
<option value="blablabla">Test</option>
<!-- ... -->
</select>
But I want to know if I can set the “value” attribute of the option tag, as a reference to an object (in javascript).
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The option value must be a “string” (that string can be a number).
What you want to do is a bit unusual but can be done (but I think there are better ways to achieve what you want to do)… You could serialize your object and set it in the value but that would be odd.
You could also index these references in an array and then set it’s index in the value of the option…