[autocomplete]如果条目末尾有空格,MustMatch不起作用
如果mustMatch被激活,我们发现,当条目最后包含一个空格时,一旦我们从列表中选择值,它将被拒绝。我们已经发现了这个问题,它在搜索事件中:在第184行,您修剪了输入的值:
$.each(trimWords($input.val()), function(i, value) {
request(value, findValueCallback, findValueCallback);
});
但是当你与列表中的值比较(第175行)时,你不会修改列表值:
if( data[i].result.toLowerCase() == q.toLowerCase() ) {
result = data[i]; break;
}
因此,输入字段中的值在列表中找不到,并被拒绝。
我们的解决方案是在比较前修剪列表值:
if( trimWords(data[i].result).toLowerCase() == q.toLowerCase() ) {
result = data[i]; break;
}
[autocomplete]如果条目末尾有空格,MustMatch不起作用的更多相关文章
- SQLServer中比较末尾带有空格的字符串遇到的坑
最近发现SQLServer中比较字符串的时候 如果字符串末尾是空格 那么SQLServer会无视那些空格直接进行比较 这和程序中平时的字符串判断逻辑不统一 );set @a=N'happycat198 ...
- 去掉Xcode源码末尾的空格
去掉Xcode源码末尾的空格 在用 Xcode 开发的时候,很容易就在行末增加一些空格了.这些空格在上传到 review board 上后 , 就会被特别的颜色显示出来.因为一种好的编程风格是说 , ...
- SQL Server中比较末尾带有空格的字符串遇到的坑 (转载)
最近发现SQLServer中比较字符串的时候 如果字符串末尾是空格 那么SQLServer会无视那些空格直接进行比较 这和程序中平时的字符串判断逻辑不统一 );set @a=N'happycat198 ...
- sql server2005版本中,len函数计算了字符串末尾的空格
sql server2005版本中,len函数计算了字符串末尾的空格的长度,以下是测试脚本: print @@version declare @v varchar(max) set @v = 'hp, ...
- c程序设计语言_习题1-18_删除输入流中每一行末尾的空格和制表符,并删除完全是空格的行
Write a program to remove all trailing blanks and tabs from each line of input, and to delete entire ...
- Python3基础 print(,end=) 输出内容的末尾加入空格
Python : 3.7.0 OS : Ubuntu 18.04.1 LTS IDE : PyCharm 2018.2.4 Conda ...
- mysql查询条件字段值末尾有空格的问题
mark MYSQL的binary解决mysql数据大小写敏感问题的方法
- jQuery自动完成组建Autocomplete
一,属性介绍 * minChars (Number) 在触发autoComplete前用户至少需要输入的字符数.Default: 1,如果设为0,在输入框内双击或者删除输入框内内容时显示列表* wid ...
- [LeetCode] Length of Last Word 求末尾单词的长度
Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the l ...
随机推荐
- nuxt跨域
根据nuxt官方文档提供的axios module 安装: npm install @nuxtjs/axios @nuxtjs/proxy --save nuxt.config.js modules: ...
- Python读取一个目录下的所有文件
#!/usr/bin/python # -*- coding:utf8 -*- import os allFileNum = 0 def printPath(level, path): global ...
- poj 3304
我老人家要开始玩几何了! .这个题有点自闭. 就是问是否存在一条直线经过所有了n条线段,(有交点). 我老人家愚昧不可救药,想了想决定先求出来 这两条直线的交点,然后看是否在线段上.但是一直写不对.. ...
- react ref获取dom对象
react文档 step = React.createRef(); // init <div ref={this.step}></div> // bind componentD ...
- 网页中顶部banner图自适应css
//test.css .index-banner-top { width: 100%; background: url(../imgs/guanyu.png) no-repeat center cen ...
- git 回滚指定行
Stage the parts you want with git add -p, then discard (git checkout -- filename) the unstaged chang ...
- Python学习之旅(九)
Python基础知识(8):集合 集合:由不同元素组成,无序的,不重复的序列 补充知识:可变类型:列表.字典:不可变类型:数字.字符串.元组 使用大括号{}或set()方法定义集合 se=set(&q ...
- currval &nextval的差异理解
--currval/nextval的区别 select * from 订单 delete --nextval INSERT INTO 订单(订单编号,单价) --nextval每执行一次,会在下列插入 ...
- PAT甲级1068 Find More Coins【01背包】
题目:https://pintia.cn/problem-sets/994805342720868352/problems/994805402305150976 题意: n个硬币,每一个有一个特有的价 ...
- yii js
页面url拼接以及页面跳转 var baseUrl = '<?php echo Yii::$app->request->baseUrl ?>';var url = baseUr ...