我想将组合框作为参数传递,但自动完成仅从组合框中获取第一个选项值,这是我的代码
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="" >
答案 0 :(得分:0)
您需要将multiple
属性添加到<select>
元素:
<select name="users" id="drp" class="search_department" multiple >