[jQuery] add value from listbox to textbox
i have to create a listbox and a textbox.
I want to select value form listbox then this value shows in textbox
<code>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/
TR/html4/strict.dtd">
<html lang="en">
<head>
<title>test</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="http://jqueryjs.googlecode.com/
files/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#edit-default-soure').change(function(){
var str = "";
$("#edit-default-soure option:selected").each(function () {
str += $(this).text() + " ";
});
$("#edit-field-sourc-0-value").text(str);
})
.change();
});
</script>
<body>
<select name="default_soure" class="form-select" id="edit-default-
soure" >
<option value="0">hongkiat.com</option>
<option value="1">smashingmagazine.com</option>
</select>
<input type="text" name="field_sourc[0][value]" id="edit-field-sourc-0-
value" ></input>
<div>
</div>
</body>
</html>
</code>
But it's not work.
Please help!