0

Possible Duplicate:
.trim() in JavaScript not working in IE

Is there any way to make .trim() work in Internet Explorer 6.

Community
  • 1
  • 1
Hector Barbossa
  • 5,506
  • 13
  • 48
  • 70
  • This question would be much easier to answer if you provided: 1) A **small** snippet of the code in question (no more than 5 lines); 2) The input to the code, if it's not obvious from the first part; 3) What output you *expected*; 4) What output you actually *observed*. Right now it's just going to get closed. – Andrzej Doyle Nov 11 '10 at 15:15

2 Answers2

4

Does this thread help you to make it work ? : .trim() in JavaScript not working in IE

At the end, look the message from kaichanvong regarding IE6

Community
  • 1
  • 1
Sébastien VINCENT
  • 1,096
  • 6
  • 11
3

make a custom function trim() for yourself

if (typeof String.prototype.trim !== 'function') {
  String.prototype.trim = function(s) {
     return s.replace(/^\s+|\s+$/g, "");
  }
}