CodeIgniter Forums
Make form field active / inactive dependent on previous choice - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Make form field active / inactive dependent on previous choice (/showthread.php?tid=53368)



Make form field active / inactive dependent on previous choice - El Forum - 07-21-2012

[eluser]DannGrant[/eluser]
Hi guys,

I'm creating a form where the user has to choose from a list of items in a dropdown box.

If they choose 'other' I then want the field underneath to become active and allow them to type in their 'other' field.

Honest answer is, i don't even know where to start.

Any pointers?


Make form field active / inactive dependent on previous choice - El Forum - 07-21-2012

[eluser]JamieBarton[/eluser]
HI Dann

You could use jQuery to handle this.

Code:
$('.dropdown').change(function () {
    $(".other_input_field").attr("disabled", $(".other_input_field").val() == "other");
});

Is this what you mean?


Regards,
Jamie