我使用jquery
autocomplete
搜索我的数据库中的数据,并且它以静态方式运行良好,但如果我更改输入id
取决于select
{{ 1}}使用jquery即使value
已经发生变化,autocomplete
也无效。
HTML
id
脚本
<select name="report_type" id="report_type"><!--remove space from select and option tag-->
<option value="" required disabled> Others
</option>
<?php
$others = array('province' => 'Province', 'city' => 'City/Municipality
', '
ethnicity ' => '
Ethnicity ', '
Religion ' => '
Religion ');
foreach($others as $key => $others){
echo "<option ";
//if($year === $yl){echo "selected";}
echo " value=\"{$key}\">{$others}</option>";
}
?>
</select>
<input id="change_me" class="type" type="text" name="category" value="" placeholder="Search here..." />
jquery自动填充
<script type="text/javascript">
$(document).ready(function() {
$("#report_type").change(function() {
$("input.type").attr("id", $(this).val() + "");
});
});
</script>