php - Dynamic Dropdown onselect -
what trying when item selected dropdown menu, make input box appear description selected on dropdown menu, can edited , updated database,
i unsure how handle javascript:
dropdown code:
<select name="captionselect" id="captionselect"> <?php foreach ($get_images $image){ echo '<option value="'.$image['id'].'">'.$image['description'].'</option>'; }; ?> </select>
assuming input has id 'captioninput', here's sample code show input dropdown's selected value:
$('#captionselect').change(function(){ $('#captioninput').val($("#captionselect option:selected").text()).show(); });
Comments
Post a Comment