function setUp(data){
    var s = ["s1", "s2", "s3"],
        data = ['test1','test2','test3'];
    if (s) {
        s.forEach(function (i) {
            $("#" + i).find('option').first().val('');
            if (data) {
                data.forEach(function (item) {
                
                  //三级联动的select的动态渲染在DOM里的,
                  //现在需要将data里的值分别放进对应下标的select的第一个option里.
                  
                });
            }
        })
    }
}
<select id='s1'></select>
<select id='s2'></select>
<select id='s3'></select>
                            
                                    Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号