0

Swipebox jquery plugin gives error in IE7 when any attached image is click (to show it in popup modal box). The error specifically points to jquery.swipebox.js in Line:815, saying:

Object doesn't support property or method 'trim'

On Line: 815 the code is as below:

loadMedia : function ( src, callback ) {
    // Inline content
    if ( src.trim().indexOf('#') === 0 ) {       // <=== Line:815
        callback.call(...)
Nah
  • 1,690
  • 2
  • 26
  • 46

1 Answers1

0

After some search I came across following solution which worked very well for me.

.trim() in JavaScript not working in IE

I added following piece of code just before the if condition:

if(typeof String.prototype.trim !== 'function') {
    String.prototype.trim = function() {
        return this.replace(/^\s+|\s+$/g, ''); 
    }
}
Nah
  • 1,690
  • 2
  • 26
  • 46