.trim() in JavaScript not working in IE
Add the following code to add trim functionality to the string.
if(typeof String.prototype.trim !== 'function') { String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ''); }}
It looks like that function isn't implemented in IE. If you're using jQuery, you could use $.trim()
instead (http://api.jquery.com/jQuery.trim/).
jQuery:
$.trim( $("#mycomment").val() );
Someone uses $("#mycomment").val().trim();
but this will not work on IE.