我的 HTML
Unit : <select name="unit_id" id="unit_id">
<option value="Select">Select</option>
<option value="1a">1/A</option>
<option value="1b">1/B</option>
<option value="1c">1/C</option>
<option value="1d">1/D</option>
</select>
查询:
$(function(){
$('#unit_id').autocomplete(
{
source: "<?php echo base_url(); ?>index.php/autocomplete/find_customer_name",
select: function(event, ui)
{
document.getElementById('customer_id').value = ui.item.customer_id;
document.getElementById('customer_name').value = ui.item.customer_name;
document.getElementById('customer_name1').value = ui.item.customer_name;
document.getElementById('dsp_due').innerHTML = ui.item.due_balance;
document.getElementById('dsp_custp').innerHTML = ui.item.package_name;
}
});
});
我想在选择框中使用我的自动完成功能。相同的代码在 input.text 框中工作正常,但我需要它作为选择框。有什么帮助吗?谢谢