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, '');
}
}
More Related Contents:
- install flash player automatically with javascript [closed]
- Why don’t self-closing script elements work?
- Why doesn’t this arrow function work in IE 11?
- Do HTML5 custom data attributes “work” in IE 6?
- forEach on querySelectorAll not working in recent Microsoft browsers
- ‘onload’ handler for ‘script’ tag in internet explorer
- How can I prevent the backspace key from navigating back?
- Can I load an entire HTML document into a document fragment in Internet Explorer?
- window.print() not working in IE
- PNG transparency issue in IE8
- “Access is denied” JavaScript error when trying to access the document object of a programmatically-created (IE-only)
- window.resize event firing in Internet Explorer
- jQuery change event on not firing in IE
- Support for ES6 in Internet Explorer 11
- Prevent Use of the Back Button (in IE)
- How can I use JavaScript to transform XML & XSLT?
- “pointer-events: none” does not work in IE9 and IE10
- IE’s document.selection.createRange doesn’t include leading or trailing blank lines
- Why does Firefox react differently from Webkit and IE to “click” event on “select” tag?
- includes() not working in all browsers
- Clone a file input element in Javascript
- JavaScript: How to simulate change event in internet explorer (delegation)
- Replace all whitespace characters
- Can’t dynamically add rows to a in IE?
- JavaScript Profiler in IE
- Images failing to load in IE with DOM: 7009 error (unable to decode) in console
- postMessage still broken on IE11?
- XMLHttpRequest: Network Error 0x80070005, Access is denied on Microsoft Edge (but not IE)
- IE e.target.id is not working
- onchange / onclick in a checkbox doesn’t work in IE