hello I'm new in html I'm trying to get id value in input field. now I'm abele to get id value in dropdown input , now I'm trying to get in normal input.
I need get ID value in this input
<div class="col-md-3">
<div class="form-group">
<label > PRICE:<span style="color:red;">*</span> </label>
<input class="form-control " name="course_Price" id="course_Price" required> </div>
</div>
</div>
my script for get value in dropdown field
<script type="text/javascript">
$(document).ready(function() {
$('#student_courses').on('change', function() {
var stateID = $(this).val();
if(stateID) {
$.ajax({
url: '/Student_Course_get_price/'+stateID,
type: "GET",
dataType: "json",
success:function(data) {
$('#course_Price').empty();
$.each(data, function(key, value) {
$('#course_Price').append('<option value="'+ value +'">''</option>');
});
}
});
}else{
$('#course_Price').empty();
}
});
});
</script>
My dropdown input
<div class="col-md-2">
<div class="form-group">
<label for="videoUrl1">Course Fees :<span style="color:red;">*</span></label>
<select name="course_Price" id="course_Price" class="form-control dynamic" data-dependent="course_Price">
<option value=""></option>
</select>
</div>
</div>
In the success function of your ajax call, use $('#course_Price').val(value);
$.each(data, function(key, value) {
$('#course_Price').append('<option value="'+ value +'">''</option>');
$(‘#course_Price’).val(value);
});