Change text box value while changing dropdown box

<?php $con = mysqli_connect("localhost","root","","db_name"); $select_material_code = "SELECT emp_id, emp_name FROM employees"; $get_material_code = mysqli_query ($con, $select_material_code); $options_material_Code = "<option>--Select Product--</option>"; $option_material_description = ""; while ($result_material_code = mysqli_fetch_array($get_material_code)) { $options_material_Code.= "<option value=".$result_material_code[1].">$result_material_code[1]</option>"; } ?> <script type="text/javascript" src="//code.jquery.com/jquery-1.8.0.min.js"></script> <select name="materialcode_1" id="materialcode_1"> <?php echo $options_material_Code; ?> </select> <input type="text" name="description_1" placeholder="Description" maxlength="40" size="40" value="" id="description_1"> <script> $("#materialcode_1").change(function(e) { $("#description_1").val($("#materialcode_1").val()) }); </script>

Share This: