Then I thought of going through Jquery way of using trim() method but then finally end up issues in IE7 ( Internet explorer).
var stringValue= ” suresh web developer bangalore”;
You see white spaces in a variable to get rid of it I tried using
$(stringValue).trim(); /*issues with IE7*/
So then finally thought of using regular expression
Worked like a charm.
Hope this will help.