1

我想过滤使用JavaScript的HTML表中的数据,它正在做的事情几乎很难弄清楚。字符串比较失败。我也尝试不做比较黑白原始物体和对象(附在屏幕上的手表值)我试着跟着, 和这些表情左手边<右手边(localeCompare也返回-1)...我错过了什么吗?字符串比较失败 - JavaScript的IE 9

condition = $(this).text().replace(/^\s\s*/, '').replace(/\s\s*$/, '').toString() == columnName.toString(); //false 
condition = $(this).text() == columnName; //false 
condition = $(this).text().replace(/^\s\s*/, '').replace(/\s\s*$/, '') == columnName.toString(); // false 
condition = $(this).text().replace(/^\s\s*/, '').replace(/\s\s*$/, '').toLocaleString().localeCompare(columnName.toLocaleString()); // -1 

enter image description here

回答

2

有在列名在调试器有值的后面加上一个空格...

你或许应该修剪COLUMNNAME或东西,如果这是一个可能的问题;我注意到你已经在调整你正在比较的价值。

+0

谢谢,我的眼睛正在跟我玩耍。我自己可能已经注意到了这一点: - /我相信这种情况,因为之前出于某种原因正在工作,并且我添加了其他functianolity – ablaze