// Trim in Javascript, JQuery, Trim in JQuery //this.replace(/^\s*/, "").replace(/\s*$/, "") pc6_summary = ($('#pc6-summary').val()).replace(/^\s*/, "").replace(/\s*$/, ""); room_title = ($('#room_title').val()).replace(/^\s*/, "").replace(/\s*$/, ""); // Implementing Trim Function for strings in JQuery, Trim Function for strings in Javascript, a trim function for strings in javascript < script language="JavaScript" type="text/javascript" > String.prototype.trim = function () { return this.replace(/^\s*/, "").replace(/\s*$/, ""); } var s = new String(" Hello "); // use it like this s=s.trim(); alert("!" + s + "!"); // end hiding contents --> < /script >
Thursday, 22 July 2010
Trim Function in Javascript
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Please post any queries and comments here.