I am new to programming, and I need your support please:
By default if you load the data, but I need the client to select this input before saving, it should show "Select", and so the client is obliged to select the input (), choose and save.
HTML:
<div class="form-group">
<label for=" codDist'">Distrito</label>
<select class="form-control " id=" codDist'" placeholder="Enter username"></select>
</div>
JS:
function cargaDistrito(depart, provin) {
var $select = $('#codDist');
$.ajax({data : {
coddepartamento : depart,
codprovincia : provin
},
url : "DistritPais",
type : "GET",
dataType : 'JSON',
success : function(data) {
$select.html('');
$.each(data,
function(key, val) {
$select.append('<option value="' + val.codDist + '">'+val.descrip+'</option>');})
},
error : function() {
$select.html('<option id="-1">Cargando...</option>');
}
});
}