i need to add input to a select option when it is selected. whenever the user selects \'other\' an input box is there for the user to enter in data.
html:
See it in action here.
HTML:
jQuery:
$(document).ready(function() {
$("#choose").on("change", function() {
if ($(this).val() === "other") {
$("#otherName").show();
}
else {
$("#otherName").hide();
}
});
});
Note the value="other"
attribute on the "Other" option. That's how the script determines if the "Other" option is selected.
Hope this helps!