logo

$10
Form field addition via JS

I'm working on an online credit app for a client and need to be able to add additional fields from a selected radio button.

Ex: There is a radio group that has two options, one is "Business" one is "Individual"
If someone clicks on Business, a text field for DBA needs to appear, If Individual is selected, DBA needs to be hidden.

Jeff Peak | 08/13/10 at 12:53pm | Edit


(1) Possible Answers Submitted...

  • avatar
    Last edited:
    08/13/10
    1:08pm
    Damian Martinelli says:

    You need to set a onclick for each input radio to show or hide the additional input text.

    Like:


    <input type="radio" name="type" value="Business" onclick="document.getElementById('dba').style.display='block';" />
    <input type="radio" name="type" value="Individual" onclick="document.getElementById('dba').style.display='none';" />
    <input type="text" name="dba" id="dba" value="" />

    • 08/13/10 1:08pm

      Jeff Peak says:

      Awesome! Thanks a bunch!

This question has expired.





Current status of this question: Completed