Adding form fields according to drop down selections of the user

What i'm trying to achieve is adding input fields relevant to user's input on the drop down selection.So then next a text field appears, to the selection.I want to keep on appending those selection input fields.

Following is what i have tried so far,

<!DOCTYPE html>

<script src=""></script>

        $("option").append("<li>Volvo: <input type="text" name="volvotype" ></li>");

        $("option").append("<li>Saab Number: <input type="text" name="saabtype" value="Mickey"><br></li>");

        $("option").append("<li>opel type: <input type="text" name="opeltype" value="Mickey"><br></li>");

        $("option").append("<li>audi type: <input type="text" name="auditype" value="Mickey"><br></li>");



  <option value="volvo" id="volvo">Volvo</option>
  <option value="saab" id="saab">Saab</option>
  <option value="opel" id="opel">Opel</option>
  <option value="audi" id="audi">Audi</option>


as @Braza suggested, i don't want to override, i want to append each selected(through dropdown menu) input fields one by one.

Answers 1

Related Articles