Jquery Chained多个不起作用

时间:2017-02-28 12:06:20

标签: javascript jquery chained-select

使用Jquery链接模块,链式选择工作,但多个父母不起作用。

我试图删除bootstrap,validator,bootcomplete ......但没有成功。

我也试过其他名字和价值观。

有人能帮助我吗?感谢。

<form  class="form-horizontal" id="formulaire" role="form" data-toggle="validator"">
    <hr/>
        <header class="row" style="margin-bottom: 20px;">
            <div class="col-md-12"><h3 class="text-center">FORMATION</h2></div>
        </header>
        <div class="row">
            <div class="col-md-4 form-group">
                <label for="formation" class="col-md-4 control-label">Intitulé de la formation<span style="color: red">*</span>&nbsp;:</label>
                <div class="col-md-8">
                    <select id="formation"  class="form-control" name="formation"  required >
                    <option value=""></option> 
                                                <option value="1">BTS Assistant Manager</option> 
                                                <option value="2">Gestionnaire des ressources humaines</option> 
                                            </select>
                <div class="help-block with-errors"></div></div>
            </div>
            <div class="col-md-4 form-group">
                <label for="niveau" class="col-md-4 control-label">Année<span style="color: red">*</span>&nbsp;:</label>
                <div class="col-md-8">
                    <select id="niveau"  class="form-control" name="niveau" required >
                        <option value=""></option> 
                                                <option class="1" value="1">BTS 1</option> 
                                                <option class="1" value="2">BTS 2</option> 
                                                <option class="2" value="5">BAC+3</option> 
                                            </select>
                <div class="help-block with-errors"></div></div>
            </div>
            <div class="col-md-4 form-group">
                <label for="sect" class="col-md-4 control-label">Section<span style="color: red">*</span>&nbsp;:</label>
                <div class="col-md-8">
                    <select id="section"  class="form-control" name="section" required >
                        <option value=""></option> 
                                                <option class="1\1" value="1">S1</option> 
                                                <option class="1\1" value="2">S2</option> 
                                                <option class="1\1" value="3">S3</option> 
                                                <option class="1\2" value="1">S1</option> 
                                                <option class="2\5" value="1">S1</option> 
                                                <option class="2\5" value="2">S2</option> 
                                            </select>
                <div class="help-block with-errors"></div></div>
            </div>
        </div>
        <div class="form-group">
            <button type="submit" class="btn btn-primary">Envoyer</button>
        </div>
    </form>
</div><!-- /.container -->


<script type="text/javascript" src="http://127.0.0.1/assets/js/jquery-3.1.1.min.js"></script>
<script type="text/javascript" src="http://127.0.0.1/assets/js/bootstrap.js"></script>
<script type="text/javascript" src="http://127.0.0.1/assets/js/validator.min.js"></script>
<script type="text/javascript" src="http://127.0.0.1/assets/js/jquery.bootcomplete.js"></script>
<script type="text/javascript" src="http://127.0.0.1/assets/js/jquery.chained.min.js"></script>
<script type="text/javascript">
$('#etudiant_adresse_code_postal').bootcomplete(
    {
        url:'../ajax/codepostal/',
        method:'post',
        minLength:2
    }
);
$('#etudiant_adresse_ville').bootcomplete(
    {
        url:'../ajax/commune/',
        minLength : 0,
        method:'post',
        formParams:
        {
            'cp' : $('#etudiant_adresse_code_postal')
        }
    }
);

$('#niveau').chained('#formation'); 
$("#section").chained("#formation, #niveau");
</script>

0 个答案:

没有答案