This is my second day with Jquery and I have a dropdown-list each time a user selects an option on that list it is shown on a textbox using the change method how can i use Jquery so that when the page first loads the first element on that dropdownlist shows in the textbox?
<script type="text/javascript">
$('#textboxx')= $('#dropdown'); // this line doesn't work how can i make it
$(function () {
$('#dropdownn').change(function () {
var selectedValue = $(this).val();
$('#textboxx').val(selectedValue);
});
});
</script>
The code below started with the $function() works correctly but as I said im having trouble binding the dropdownlist value to the textbox when the page is first loaded.
You need to assign the selected value of select to textbox on document.ready.
Change
To
And put in document.ready, You code would be