Script Categories

Forms >>> Ignore Spaces.

Removes spaces from a string variable within a script or from user input into a text box. Several different uses are shown on the script example page.

Before:  String = x xx xxx xxxx
After: String =
Or, try entering a string with spaces in this box.

Add the below code to the <body> section of your page:

<script language="javascript" type="text/javascript">
/* Visit for full source code
and get more free JavaScript, CSS and DHTML scripts! */
<!-- Begin
function ignoreSpaces(string) {
var temp = "";
string = '' + string;
splitstring = string.split(" ");
for(i = 0; i < splitstring.length; i++)
temp += splitstring[i];
return temp;
//  End -->
Before:  String = x xx xxx xxxx<br>
After:  String = <script language="JavaScript">
document.write(ignoreSpaces("x xx xxx xxxx"));
Or, try entering a string with spaces in this box.
type=text size=25 onBlur="this.value=ignoreSpaces(this.value);">
type=button value="Ok">

JavaScript Editor Get Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.

Code was highlighted by 1st JavaScript Editor (The Best JavaScript Editor!).