dtup3446 2013-10-04 23:19
浏览 66
已采纳

从PHP mySQL查询jQuery自动完成

I am trying to follow this tutorial on autocomplete: http://www.jensbits.com/2010/03/29/jquery-ui-autocomplete-widget-with-php-and-mysql/

I am open to others if anyone has suggestions, but I digress. I want to type the last name of a guest and get a list displayed below of all the matches. However I get something real screwy where it says "1 result is available, use up and down arrow keys to navigate." and has a tiny dot somewhere in the text I can click which will fill my readonly textboxes. How can I get this to function properly? I honestly don't know where I am going wrong. I will post my html and jQuery. My php obviously works fine so I don't feel it's necessary to post.

<div class="guestinfo">
    <p class="ui-widget">
        <div><label>Exisiting Guest List</label></br>
        <input type="text" name="guests" id="guests"/></div>
        <input readonly="readonly" type="text" id="firstname" name="firstname"/>
        <input readonly="readonly" type="text" id="lastname" name="lastname"/>

        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
        <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"></script>
        <script>
            $(function() {
                $('#guests').val("");

                $("#guests").autocomplete({
                    source: "classes/autocomplete_guests.php",
                    minLength: 2,
                    select: function(event, ui) {
                        $('#firstname').val(ui.item.fname);
                        $('#lastname').val(ui.item.lname);
                    }
                });
            });

        </script></p>
  • 写回答

1条回答 默认 最新

  • dongzhan1570 2013-10-04 23:24
    关注

    This is an accessibility feature, you can easily fix this in css, try adding this in your stylesheet:

    .ui-helper-hidden-accessible {
        display:none;
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Qt下使用tcp获取数据的详细操作
  • ¥15 idea右下角设置编码是灰色的
  • ¥15 全志H618ROM新增分区
  • ¥20 jupyter保存图像功能的实现
  • ¥15 在grasshopper里DrawViewportWires更改预览后,禁用电池仍然显示
  • ¥15 NAO机器人的录音程序保存问题
  • ¥15 C#读写EXCEL文件,不同编译
  • ¥15 MapReduce结果输出到HBase,一直连接不上MySQL
  • ¥15 扩散模型sd.webui使用时报错“Nonetype”
  • ¥15 stm32流水灯+呼吸灯+外部中断按键