I want to have a select option that opens a corresponding text box.
Let’s say these are my selections:
<select id="contact">
<option value="email">Email</option>
<option value="phone">Phone</option>
</select>
When you select the Email selection I want it to show a textbox below it (which wasn’t there before) that says please enter your Email.
OR
When you select the Phone selection I want it to show a textbox below it (which wasn’t there before) that says please enter your Phone Number.
I don’t want both the “Enter Email” and “Enter Phone Number” textboxes showing at the same time. I want them to select which one to open and input their contact info.
I currently have this but don’t know what else to have in it… please help!
$('#contact').change(function() {
if ($(this).val() === 'email') {
//show email
//hide phone
} else {
//hide email
//show phone
}
});
Thanks,
Chad.
Figured it out, used the following javascript for this:
Then had this in the form: