php - Load the data to the texbot from the drop down menu -
fellow experts,
i have following text field:
<input type="text" id="url0" class="text_box" name="url"> and following php code load files drop down menu:
<html> <head> <title>test</title> </head> <body> <select name="s1"> <option value="" selected="selected">-----</option> <?php foreach(glob(dirname(__file__) . '/files/*') $filename){ $filename = basename($filename); echo "<option value='" . $filename . "'>".$filename."</option>"; } ?> </select> </body> </html> when select data drop down menu, display on above text field.
it's simple hooking onchange event of jquery
$("[name='s1']").change(function(evnt) { $("#url0").val(evnt.target.value); }); jsfiddle: http://jsfiddle.net/n8fse/2/
Comments
Post a Comment