首页 > 代码库 > chose.jquery 联动
chose.jquery 联动
<link href="http://www.mamicode.com/~/Scripts/chosen/chosen.css" rel="stylesheet" />
<script src="http://www.mamicode.com/~/Scripts/chosen/chosen.jquery.js"></script>
<script type="text/javascript">
$(function () {
$("#ProvId").change(function(){
var citys = [];
console.log($(this).val());
console.log($("#CityId"));
$("#CityId").append("<option value=http://www.mamicode.com/‘01‘ >广州");
var obj = {};
$("#CityId").chosen();
});
});
</script>
<dt>省份</dt>
<dd>
@Html.DropDownList("ProvId", SdJobs.Controllers.HomeController.ProvinceList, "--请选择--", new { @class = "chosen-select-width input normal", @tabindex = "2" })
<span class="Validform_checktip"></span>
</dd>
<dt>城市</dt>
<dd>
<select id="CityId" class="chosen-select-width input normal" >
<option value="">--请选择--</option>
</select>
<span class="Validform_checktip"></span>
</dd>
<dt>县区</dt>
<dd>
<select id="CountyId" class="chosen-select-width input normal" >
<option value="">--请选择--</option>
</select>
<span class="Validform_checktip"></span>
</dd>
<script type="text/javascript">
var config = {
‘.chosen-select‘: {},
‘.chosen-select-deselect‘: { allow_single_deselect: true },
‘.chosen-select-no-single‘: { disable_search_threshold: 10 },
‘.chosen-select-no-results‘: { no_results_text: ‘Oops, nothing found!‘ },
‘.chosen-select-width‘: { width: "200%" }
}
for (var selector in config) {
$(selector).chosen(config[selector]);
}
</script>
chose.jquery 联动