我的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>
Jquery的:
$(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框中工作正常,但我需要它作为选择框。任何帮助? 谢谢