area.js 给三级联动插件添加默认值

<select class="select automatic" id="s_province" name="province">
       <option>请选择省</option>
</select>

<select class="select automatic" id="s_city" name="city">
     <option>请选择市</option>
</select>

<select class="select automatic" id="s_county" name="county" >
         <option>请选择市</option>
</select>

// 后台 后台获取已经储存的城市
<input type="hidden" class="init_default province_default" name="province"  value="" >
<input type="hidden" class="init_default city_default" name="city"  value="" >
<input type="hidden" class="init_default county_default" name="county"  value="" >

var province_default = $('.province_default');
var city_default = $('.city_default');
var county_default = $('.county_default');

var Province = $('#s_province').find('option');
for (var i=0;i < Province.length ;i++){
    if (Province.eq(i).val() == province_default.val()){
        Province.eq(i).prop('selected',true);
        Province.eq(i).trigger('change');
    }
}

var City = $('#s_city').find('option');
for (var i=0;i < City.length ;i++){
    if (City.eq(i).val() == city_default.val()){
        City.eq(i).prop('selected',true);
        City.eq(i).trigger('change');
    }
}

var County = $('#s_county').find('option');
for (var i=0;i < County.length ;i++){
    if (County.eq(i).val() == county_default.val()){
        County.eq(i).prop('selected',true);
        County.eq(i).trigger('change');
    }
}

$(function () {

    init();

    $('.automatic').change(function () {
        var changeClass = $(this).prop('name')+'_default';
        var values = $(this).val();
        $('.'+changeClass).val(values);
    })

})