.trim() in JavaScript not working in IE

来源:互联网 发布:人工神经网络算法 编辑:程序博客网 时间:2024/05/16 09:47


trim 方法 (String) (JavaScript)

 

从字符串中移除前导空格、尾随空格和行终止符。


IE8下,Javascript的String.trim()方法会报错,建议使用JQuery的$.trim()方法。


以下来自MSDN:

在以下文档模式中受支持:Internet Explorer 9 标准模式、Internet Explorer 10 标准模式和 Internet Explorer 11 标准模式。此外,也在应用商店应用(Windows 8 和 Windows Phone 8.1)中受支持。请参阅版本信息

在以下文档模式中不受支持:Quirks、Internet Explorer 6 标准模式、Internet Explorer 7 标准模式、Internet Explorer 8 标准模式。


http://stackoverflow.com/questions/2308134/trim-in-javascript-not-working-in-ie


https://msdn.microsoft.com/library/ff679971(v=vs.94).aspx

0 0
原创粉丝点击