看起来不错,请看一下。控制台有错误吗?也许您忘了在doc ready中包含jquery lib还是不包含?
$(document).ready(function(e) {
var arrLoanType = {
1:"Regular Loan",
2:"Emergency Loan",
3:"Special Loan"}
$.each(arrLoanType, function(index, value){
$("#loanType").append("<option value='"+index+"'>"+value+"</option>");
});
$('#loanType option').filter(function () {
return $(this).text() == $("#loanSelected").val();
}).attr('selected','selected');
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.10.0/jquery.min.js"></script>
<select name="" id="loanType" class="form-control" required=""></select>
<input id ="loanSelected" value="Special Loan" type="hidden">