如果id通过jquery更改,则jquery自动完成不起作用

时间:2015-09-04 02:02:19

标签: javascript jquery autocomplete

我使用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>  

0 个答案:

没有答案