【问题标题】:Jquery Autocomplete clear textbox if no match found如果未找到匹配项,则 Jquery 自动完成清除文本框
【发布时间】:2010-01-11 14:10:51
【问题描述】:

我正在使用 Jquery 的自动完成插件在我的应用程序中显示智能搜索文本框。

为了获得更好的想法请参考以下网址

http://docs.jquery.com/Plugins/Autocomplete

现在我想要的是,当用户继续在文本框中输入时,尊重的过滤结果会附加到文本框中,这很好。如果用户键入的字符与结果不匹配,那么我想清除该字符。

表示我想强制用户只输入自动完成结果中的那些字符。

提前致谢。

萨钦

【问题讨论】:

  • 我得到了解决方案.. $('#'+Artist.id).autocomplete(xmlhttp.responseText.split("~")[0].split(","), { matchContains :false, minChars:1, autoFill:false, mustMatch:true, cacheLength:20, max:20 });这解决了我的问题

标签: javascript jquery autocomplete


【解决方案1】:
$('#'+Artist.id).autocomplete(responce, { 
        matchContains:false, 
        minChars:1,  
        autoFill:false, 
        mustMatch:true, 
        cacheLength:20, 
        max:20 
    });

您可以使用上面提到的一个覆盖 .autocomplete(responce) 并根据您的要求设置参数。

MustMatch=true 解决了我的问题。

【讨论】:

    猜你喜欢
    • 2015-11-28
    • 1970-01-01
    • 1970-01-01
    • 2013-08-30
    • 2012-07-21
    • 2012-10-28
    • 2023-03-17
    • 1970-01-01
    • 2015-01-28
    相关资源
    最近更新 更多