I have two options that show different questions each. If the user decides to change their option at the last minute. Any inputs within option 1 will then hide and show option 2.
But i need all input texts to be removed and disabled from option 1 to continue to option 2 if they decide to change the option at the last minute.
Ive tried to switch the inputs with different names/ids and i tried disabling them after they change from option 1 to option 2. But it shows both options when sent to their email after being finished.
This is the code to disable the input from an option
If they choose option 1 and then option 2 then therefore all of option 1's questions will be disabled BUT it will not remove the texts nor will it disable it.
HTML CODE Option 1 & 2
<select id='dropdown'>
<option value="1">Pet questions</option>
<option value="2">Income questions</option>
</select>
HTML CODE questions & answers to option 1
How many dogs do you have? <input type="text" class="textInput1" />
How many cats do you have? <input type="text" class="textInput1" />
Do you like dogs more or cats? <input type="text" class="textInput1" />
HTML CODE questions & answers to option 2
How many dogs do you have? <input type="text" class="textInput2" />
How many cats do you have? <input type="text" class="textInput2" />
Do you like dogs more or cats? <input type="text" class="textInput2" />
jQuery CODE
$('#dropdown').change(function() {
if( $(this).val() == 1) {
$('.textInput1').prop( "disabled", false );
} else {
$('.textInput1').prop( "disabled", true );
}
if( $(this).val() == 2) {
$('.textInput2').prop( "disabled", false );
} else {
$('.textInput2').prop( "disabled", true );
}
});
What i want to know is, how can i fit within this code the option to remove the input text, at the same time it has been disabled?