doukengzi3517 2014-06-26 09:34
浏览 46

预测下拉输入

I have a table called contacts, where each user stores the username of his contacts:

$result = mysql_query("SELECT * FROM contacts WHERE sender='".$_SESSION ["username"]."'");
$row  = mysql_fetch_array($result);

My page is used to compose a message to an user. So when a user types in the textfield I need to show a dropdown list matching names from his contacts (as in Gmail).

<input name="reciever" type="text" value="" class="inputs3" placeholder="Enter the username"/>

I searched a lot, but couldn't find any working script.

  • 写回答

1条回答 默认 最新

  • douxun7992 2014-06-26 09:53
    关注

    Take a look at this auto complete sample, Demo

    autocomplete({
            minLength: 1,
            source: function( request, response ) {
              //check if the request string starts with a space
              if(request.term===' ')
              {
                response([{value: "Enter Some text to search"}]);
                return false;
              }
              // delegate back to autocomplete, but extract the last term
              response( $.ui.autocomplete.filter(
              availableTags, extractLast( request.term ) ) );
            }
    

    This will give autocomplete coding idea

    评论

报告相同问题?

悬赏问题

  • ¥15 (标签-UDP|关键词-client)
  • ¥15 关于库卡officelite无法与虚拟机通讯的问题
  • ¥15 qgcomp混合物线性模型分析的代码出现错误:Model aliasing occurred
  • ¥100 已有python代码,要求做成可执行程序,程序设计内容不多
  • ¥15 目标检测项目无法读取视频
  • ¥15 GEO datasets中基因芯片数据仅仅提供了normalized signal如何进行差异分析
  • ¥100 求采集电商背景音乐的方法
  • ¥15 数学建模竞赛求指导帮助
  • ¥15 STM32控制MAX7219问题求解答
  • ¥20 在本地部署CHATRWKV时遇到了AttributeError: 'str' object has no attribute 'requires_grad'