How do I create a text box if a certain item is selected from a drop-down list?


I have a drop-down list that contains the following values:


When the user select Other, I want to show a text box. How can I do that?

I'm using Laravel 4.2

One method:

<script type="text/javascript>
// Function to on change of the <select>, display the other input box
    if($("#choices').val() == "Other"){

<!-- hide the input box initially -->
#otherinput{display: none;}
<!-- These must have values since they're options, FYI, but set an ID for select and add values to options -->
<select id='choices'>
<option value='Aramex'>Aramex</option>
<option value='DHL'>DHL</option>
<option value='FedEx'>FedEx</option>
<option value='Other'>Other</option>
<!-- hidden until you select other option within the <select> -->
<input type='text' name='textinput' id='otherinput' />