我需要在多选下拉列表中应用复选框,但不成功。我正在使用发送表单创建多选下拉列表。但不选中此多选下拉列表中的复选框。所以请帮忙

<?php
    echo $this->formSelect(
        'ctr_partnerId',
        $expPartId,
        array(
            'class' => 'select_input',
            'multiple' => true,
            'size' => 10
        ),
        $this->usrName
    );
?>


我正在使用jQuery

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
<script src="http://cdn.rawgit.com/davidstutz/bootstrap-multiselect/master/dist/js/bootstrap-multiselect.js" type="text/javascript"></script>

<script>
    $('select[multiple]').multiselect({
        includeSelectAllOption: true,
    });
</script>

最佳答案

我认为您的html有问题,因为它对我来说很完美

使用唯一选择器使用select[name="ss"]id



$('select[name="ss"]').multiselect({
                includeSelectAllOption: true,
            });

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
    <link href="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css"
        rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
    <link href="http://cdn.rawgit.com/davidstutz/bootstrap-multiselect/master/dist/css/bootstrap-multiselect.css"
        rel="stylesheet" type="text/css" />
    <script src="http://cdn.rawgit.com/davidstutz/bootstrap-multiselect/master/dist/js/bootstrap-multiselect.js"
        type="text/javascript"></script>



<select name="ss" class="select_input" multiple >
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>

07-24 09:15