I'm struggling to set the correct answer from a dropdown list for my current project. The task involves displaying a question with blanks, and allowing users to choose the correct value for these blanks from a dropdown menu.
Is there a way to programmatically set the correct value from the dropdown list?
You can view a sample JSFiddle demonstrating a basic dropdown list below:
<select id="button1" class="button" title="Button 1">
<option value="">--Please choose an option for the first blank--</option>
<option id="buttonText1_1" class="buttonText">1</option>
<option id="buttonText1_2" class="buttonText">2</option>
<option id="buttonText1_3" class="buttonText">3</option>
<option id="buttonText1_4" class="buttonText">4</option>
<option id="buttonText1_5" class="buttonText">5</option>
<option id="buttonText1_6" class="buttonText">6</option>
</select>
CSS:
.buttonText {
padding: 20px;
display: block;
}
.button {
width: calc(100% - 4px);
position: relative;
margin-bottom: 20px;
text-align: center;
background-color: #F8F8F8;
border: 2px solid #EAEAEA;
border-radius: 6px;
cursor: pointer;
-webkit-tap-highlight-color: transparent;
max-width: 500px;
min-height: 65px !important;
}
Your assistance is greatly appreciated!