0

我想将组合框作为参数传递,但自动完成仅从组合框中获取第一个选项值,这是我的代码
Jquery:

 <script type="text/javascript">
        var op="";
        $(document).ready(function(){

            $("#drp").change(function(){
                op=$("#drp").val();
            });
            $("#tag").keypress(function(){
                op=$("#drp").val();
            });
            $("#tag").autocomplete("search_all_check.php", {
                selectFirst: true,
                extraParams: { param: op }
            });
        });
    </script> 

和html:

 <select  name="users" id="drp"  class="search_department" >
                   <option name="graid" id="grade_id" value="grade">Graid</option>
                    <option name="div" id="div_id"  value="division">Division</option>
                    <option name="department" id="dep_id"  value="department">Department</option>
                    <option name="card" id="card_id"  value="id_card">Id Card</option>
                    <option name="education" id="education_id"  value="education">Education</option>
                    <option name="age" id="age_id"  value="age">Age</option>
                 </select>
            <input type="text" name="text" id="tag" value="" >
4

1 回答 1

0

您需要将multiple属性添加到您的<select>元素:

<select  name="users" id="drp"  class="search_department" multiple >
于 2012-12-24T06:37:29.587 回答