Its not exactly a well kept secret that web developers loathe IE6, but I never expected to leave out a simple function such as String.trim().
A simple test script such as this would cause an error.
1.
alert(
" hello world "
.trim());
Luckily, theres an easy fix for that! Simply paste this code near the top before any trim() calls are made.
1.
if
(!(
'trim'
in
String.prototype)) {
2.
String.prototype.trim =
function
() {
return
this
.replace(/^\s+|\s+$/g,
""
); };
3.
}
[ Source ]