Php jQuery自动完成输出所有结果,而不是匹配字符串
我对JSON和jQuery比较新。我需要进行jQuery自动完成,为此我提出:Php jQuery自动完成输出所有结果,而不是匹配字符串,php,json,jquery,jquery-autocomplete,Php,Json,Jquery,Jquery Autocomplete,我对JSON和jQuery比较新。我需要进行jQuery自动完成,为此我提出: <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script src="http://code.jqu
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script>
jQuery(document).ready(function($){
$('#executives').autocomplete({source:'search_executives.php', minLength:2});
});
</script>
现在我的问题是-
值
(例如3)。我需要打印高管的姓名,并将其员工id
作为其值注:第一部分已解决。我忘了在
SQL
中添加LIKE
条件 您正在使用一个输入文本框。
文本框的值属性显示在前端文本框中,您无法更改它。(即)您案例中的员工id。您正在使用一个输入文本框。
文本框的值属性显示在前端文本框中,您无法更改它。(即)您的员工id。您必须将输入值设置为
标签,然后在选择项目时,使用另一个字段存储员工id
:
select: function(e, ui) {
e.preventDefault();
this.value = ui.item.label;
$('#other_field').val(ui.item.value);
}
您必须将输入值设置为标签
,然后在选择项目时,使用另一个字段存储员工id
:
select: function(e, ui) {
e.preventDefault();
this.value = ui.item.label;
$('#other_field').val(ui.item.value);
}
如果我希望标签
以php
中的值
属性作为其值显示在文本框中,我需要做什么?如果我希望标签
以php
中的值
属性作为其值显示在文本框中,我需要做什么?
select: function(e, ui) {
e.preventDefault();
this.value = ui.item.label;
$('#other_field').val(ui.item.value);
}